I was running the code example below, initially trying to print a character array backwards where count
represented the number of characters in the array. Everytime I ran the for loop, i
was not initalized to count - 1
instead it was initialized to some very large number. But outside the loop, i is properly initalized to 4. I can't explain why this is happening.
size_t count {5};
size_t i {count - 1UL}; // i is initalized to 4
for(size_t i {count - 1}; i >= 0UL; --i) {
std::cout << i << std::endl;
} // infinite loop, i is initalized to 18446744073709141874