+ 1
#include <iostream> using namespace std; int main() { string s = "SoloLearn"; cout << (s[1]==s[3]); }
What is the benefit of writing a "SoloLearn" in this above statement if the answer will come "1" ?
2 Answers
+ 3
Can you spot out why answer is 1 ?
Try with other values..
You are comparing characters at indexes 1,3 in string s. if equals, it returns 1, else 0...
+ 2
Thanks a lot, that's help me to understand better :)