What is the output of this C code?
#include
int main()
{
printf("C programming %s", "Class by\n%s Sanfoundry", "WOW");
}
Answer: C
This program has only one %s within first double quotes, so it does not read the string “WOW”.
The %s along with the Sanfoundry is not read as a format modifier while new line character prints the new line.
Output:
$ cc pgm2.c
$ a.out
C programming Class by
%s Sanfoundry