why, is this weird behaviour of c++?

Правка en1, от rashid_aziz, 2022-08-02 19:45:07

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

Теги c++, string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
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)