EmbLogic's Blog

output is 2 1 1.how??//

#include<stdio.h>
int main()
{
int x,y,z;
x=y=z=1;
++x||++y&&++z;
printf(“%d\t%d\t%d\n”,x,y,z);
return 0;
}

One Response to output is 2 1 1.how??//

  1. pushpa says:

    here x is preincremented first so x=2
    there is || operation.anything ORed with 1 is 1.Hence compliler doesnt evaluate further expression.so y & z values remains unchanged

Leave a Reply to pushpa Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>