[dgplug-users] assignment suppression is giving a warning

Sunny Sharma sunny20062010 at gmail.com
Sat Dec 26 03:56:43 PST 2009


Got it. actually it slipped from my eyes :) thanks

On Sat, Dec 26, 2009 at 3:14 PM, Aanjhan R <aanjhan at gmail.com> wrote:

> On Sat, Dec 26, 2009 at 4:10 AM, Sunny Sharma <sunny20062010 at gmail.com>
> 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 operated in this way if it is used within another printf.
>
> Lets take the innermost printf
>
> printf("%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
> Users at lists.dgplug.org
> http://lists.dgplug.org/listinfo.cgi/users-dgplug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dgplug.org/pipermail/users-dgplug.org/attachments/20091226/e122aa53/attachment-0002.htm>


More information about the Users mailing list