+ 3

why it is not printing the length of string?

#include<cstdio> #include<string.h> int main() { char s[100]; scanf("%s",s); int n=strlen(s); printf("%n",&n); }

2nd Jun 2018, 6:26 AM
Bahubali
Bahubali - avatar
4 Antworten
+ 5
you are supposed to use %d instead of %n in last line
2nd Jun 2018, 6:31 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
What you wanted to print? strlen function is used to print length of string.
2nd Jun 2018, 6:29 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
i want to print length. it is not printing
2nd Jun 2018, 6:30 AM
Bahubali
Bahubali - avatar
0
thanks i got it
2nd Jun 2018, 6:34 AM
Bahubali
Bahubali - avatar