下記のコードを実行しますと、『プログラムの表示』に示すようなものとなります。
Q1)この件に関しまして、説明、コメント頂けますと大変有りがたいです。
void MainWindow::on_pushButton_clicked(){
const int vect[1] = {1};
/*
for(int i = 0; i < 5; i++){
cout << vect[i] << endl;
}
*/
int cnt=0;
for(int x : vect){
cout << x << endl;
qDebug("=======%d",x);
if(cnt++==5) break;
}
qDebug("end");
}
プログラムの表示
-1080128960
-1080128960
-1080128960
-1080128960
-1080128960
-1080128960
=======-1080128960
=======-1080128960
=======-1080128960
=======-1080128960
=======-1080128960
=======-1080128960
end
以上
回答2件
あなたの回答
tips
プレビュー