I made a couple of typo mistakes in that mail. Should'nt mail before I
have fully woken up ;). Corrected the contents below.

On Sat, Dec 26, 2009 at 10:44 AM, Aanjhan R <[email protected]> wrote:
> On Sat, Dec 26, 2009 at 4:10 AM, Sunny Sharma <[email protected]> wrote:
>> oh no! then it is creating a problem...never mind. well there is another one
>> if   int x = 1, y = 1;
>> printf("%d",printf("%d%d",x,y));
>>
>> the output is coming 1 12 can you explain me how?
>
> Yes it is correct!
>
> printf operates in this way if it is used within another printf.

^^^^^^^^^^^^^^^^^^

> Lets take the innermost printf
>
> printf("%d %d",x,y) -> is printed as 11 (clear)

^^^^^^^^^^^^^^^^^^^^^

> the outer printf now works a bit tricky.
>
> printf("%d", <previousprintfoutput>)
>
> Now this printf prints the length of the characters printed by the
> inner printf i.e two.
>
> The net output is now 112 which is what you get.
>
> If you modify the code to be something like printf("%d",printf("%d\t%d", x, 
> y))
>
> You will get 113 as output as \t is another character.
>
> Hope it helps.
>
> Aanjhan
>
_______________________________________________
Users mailing list
[email protected]
http://lists.dgplug.org/listinfo.cgi/users-dgplug.org

Reply via email to