include
using namespace std; int main() { string s = "abcd"; int i = -1; while(i < s.size()){ cout << "inside "; i++; } cout << "outside"; return 0; }
why this loop does not run, where as when we initialize i = 0, then it runs properly
why, is this weird behaviour of c++?
using namespace std; int main() { string s = "abcd"; int i = -1; while(i < s.size()){ cout << "inside "; i++; } cout << "outside"; return 0; }
why this loop does not run, where as when we initialize i = 0, then it runs properly
| Rev. | Lang. | By | When | Δ | Comment | |
|---|---|---|---|---|---|---|
| en2 |
|
rashid_aziz | 2022-08-02 19:45:38 | 2 | Tiny change: '#include <' -> '\n#include <' | |
| en1 |
|
rashid_aziz | 2022-08-02 19:45:07 | 338 | Initial revision (published) |