↵
#include <iostream>↵
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
#include <iostream>↵
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