In printf("abdooo,%s\n ")
what does %s
mean ?
And what will happen if I delete it?
Here is some details about printf()
in C.
Long-story-short, %s
is known as a string placeholder. And does exactly that: it "leaves room" for a string
to be printed out.
E.g.:
printf("%s\n", "Hello!");
would output:
Hello!
to your terminal / console.
Of course, you could have printed "Hello!" right away, but the use of %s
is in order to print out a variable's value at a given point in time:
string test = "Hello!";
printf("%s\n", test);
would also output:
Hello!
Hope it's clearer!
printf("%s\n", "");
you'll get only the newline character printed out. If you pass in an empty string, you print out an empty string, not a space.