D
desktop
I have this nested while:
int numsx[] = { 11, 22, 33, 44, 55, 77, 88, 99};
int* startx = numsx;
int endx = sizeof(numsx) / sizeof(numsx[0]);
int* endxp = numsx + endx;
int numsy[] = { 1, 2, 3, 9};
int* starty = numsy;
int endy = sizeof(numsy) / sizeof(numsy[0]);
int* endyp = numsy + endy;
while (startx != endxp){
std::cout << " *startx " << *startx << std::endl;
while (starty != endyp) {
std::cout << " *starty " << *starty << std::endl;
starty++;
}
startx++;
}
but when I run it I get:
*startx 11
*starty 1
*starty 2
*starty 3
*starty 9
*startx 22
*startx 33
*startx 44
*startx 55
*startx 77
*startx 88
*startx 99
Any ideas on why the inner while only gets executed once?
int numsx[] = { 11, 22, 33, 44, 55, 77, 88, 99};
int* startx = numsx;
int endx = sizeof(numsx) / sizeof(numsx[0]);
int* endxp = numsx + endx;
int numsy[] = { 1, 2, 3, 9};
int* starty = numsy;
int endy = sizeof(numsy) / sizeof(numsy[0]);
int* endyp = numsy + endy;
while (startx != endxp){
std::cout << " *startx " << *startx << std::endl;
while (starty != endyp) {
std::cout << " *starty " << *starty << std::endl;
starty++;
}
startx++;
}
but when I run it I get:
*startx 11
*starty 1
*starty 2
*starty 3
*starty 9
*startx 22
*startx 33
*startx 44
*startx 55
*startx 77
*startx 88
*startx 99
Any ideas on why the inner while only gets executed once?