Passing comma separated strings to printf. Discards the second argument, why?

Why does printf discard all the arguments except one when separated by commas?
For instance the following program gives hello as output.


 
  printf("hello","world","duh");
You are misunderstanding how printf works. You only give it one string, and seperating by commas allows you to format the string, based on specifiers. See http://www.cplusplus.com/reference/cstdio/printf/?kw=printf for details.

Example:
 
printf("%s %s %s", "hello", "world", "duh");
Topic archived. No new replies allowed.