Oh I see. You're thinking that:
Code:
printf("A","B","C");
will print ABC, right? It won't. The first parameter to printf is called a format string. It contains text and symbols that indicate the meaning of the parameters that follow. So %c is a character, %s is a string, %d is a number, and there are lots more, so the code:
Code:
printf("Character:%c;  String:%s;  Number:%d\n", 'f', "Hello world", 27);
will display:
Character:f; String:Hello world; Number:27
and the \n means end of line.

So if we look at my second bit of code:
Code:
char*s="AAA %c %s %c BBB";
main()
{
printf(s,'\"',s,'\"');
}
printf will interpret the first parameter to mean:
"AAA ";
then a character because of %c;
then a string because of %s;
then another character because of %c;
then " BBB".

The %c, %s and %c match to '\"', s itself, and '\"' respectively, so the output will be:
"AAA ";
then '\"' because of %c;
then "AAA %c %s %c BBB" because of %s;
then '\"' because of %c;
then " BBB".

which in total will be:

AAA "AAA %c %s %c BBB" BBB".

It's a bit confusing because of the double usage of s. Let's specify the format string literally, and use "sausage" instead of duplicating the format string, and X instead of that escaped double quote.
Code:
char*s="sausage";
main()
{
printf("AAA %c %s %c BBB",'X',s,'X');
}
The output of this will be: AAA X sausage X BBB. Clear?
IndiraP like this