-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathnestedTesting.cpp
More file actions
31 lines (27 loc) · 812 Bytes
/
nestedTesting.cpp
File metadata and controls
31 lines (27 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]){
for (int i = 0; i < 2; ++i) {
for (int i = 0; i < 3; ++i) {
for (int i = 0; i < 4; ++i) {
cout << i << '\t';
}
//cout << "2nd " << i << "\t";
cout << endl;
}
cout << endl;
}
return 0;
}
/*
When we execute line 11, we get an error:
nestedTesting.cpp: In function 'int main(int, const char**)':
nestedTesting.cpp:11:22: warning: name lookup of 'i' changed [enabled by default]
cout << "2nd " << i << "\t";
^
nestedTesting.cpp:7:12: warning: matches this 'i' under ISO standard rules [enabled by default]
for (int i = 0; i < 3; ++i){
^
nestedTesting.cpp:8:13: warning: matches this 'i' under old rules [enabled by default]
for (int i = 0; i < 4; ++i){
*/