+ 10
Explain the output please....?
12 Answers
+ 8
Samanvitha P R yeah am getting same output
+ 8
Martin Taylor thanks for explanation i understood very well
+ 7
Samanvitha P R but why its printing @
+ 6
Samanvitha P R sorry i understood because size was less so its printing garbage now i increased the length then its printing properly but why %s not printing two times
+ 6
Dennis yes i understood but wht %s not printed two times
+ 6
Dennis ohh i understood thanks
+ 2
Because the first parameter of printf is a format specifier which replaces the formats "%s" in this case with the 2nd and so on parameters. ( even if you don't provide one, so be careful there )
The 2nd parameter and so on don't have this behaviour.
+ 1
Your character array is not big enough to include the null character so anything can happen when it tries to print it.
0
Martin Taylor your explanation is very clear man . Thank you.