+ 6

What is the output of following code and explain.

#include<string.h> char str[]="love"; int i; i=strlen(str); cout<<i%3;

3rd Aug 2017, 11:05 AM
Niharika.R
Niharika.R - avatar
4 Respostas
+ 8
yeah, it was auto corrected,btw I recorrected it! @highman
3rd Aug 2017, 11:11 AM
Niharika.R
Niharika.R - avatar
+ 7
string length is 4 4is stored in i, 4%3 is 1
3rd Aug 2017, 11:08 AM
Niharika.R
Niharika.R - avatar
+ 3
I would say that your code is wrong.Probably you wanted to write strlen insted of stolen and I=stolen(str) should be i=strlen(str).If yes,I would expect the result 1.
3rd Aug 2017, 11:10 AM
Highman
Highman - avatar
+ 1
1
9th Aug 2017, 7:04 PM
sai mahale
sai mahale - avatar