+ 1
Why did the result turn out? (1)
char s[]="Sololearn"; int c=(s[1]==s[3]); Printf("%d", c);
1 Réponse
+ 5
Remember array indexing starts at zero, so
s[ 0 ] -> 'S'
s[ 1 ] -> 'o'
...
and so on. Since the characters at index one and three are the same, the comparison operator returns true, which is usually an integral value of one. That value is then printed to the console.