+ 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" ?

28th Mar 2023, 11:44 AM
Muhammad Bilal
Muhammad Bilal - avatar
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...
28th Mar 2023, 12:04 PM
Jayakrishna 🇼🇳
+ 2
Thanks a lot, that's help me to understand better :)
28th Mar 2023, 12:11 PM
Muhammad Bilal
Muhammad Bilal - avatar