string s= "codechef";
int mxlen= -1;
if(s.length()>mxlen) cout<<1<<endl;
else cout<<0<<endl;
The above code outputs => 0
Whereas the below code outputs => 1
string s= "codechef";
int mxlen= -1;
int tempLen= s.length();
if(tempLen>mxlen) cout<<1<<endl;
else cout<<0<<endl;
What’s the difference in the two given codes?