Whats the output of.....>>?

#include
#include
void main()
{
int a=1;
if(a=1,3,5,6)
printf("good&a=%d",a);
else
printf("bad&a=%d",a);
}
}

Questions by geekaayuush

Showing Answers 1 - 5 of 5 Answers

mohan

  • Oct 5th, 2012
 

good&a=1

  Was this answer useful?  Yes

The resulting output is "good&a = 6".

Reason: the result of the expression 1,3,5,6 is 6, which is assigned to a as part of the condition. Since 6 is non-zero, the first branch is taken.

Read up on the comma operator for details.

  Was this answer useful?  Yes

udit

  • Oct 31st, 2012
 

good&a=1

  Was this answer useful?  Yes

rahul jadhav

  • Nov 21st, 2012
 

good&a=1

  Was this answer useful?  Yes

FahadFirozKhan

  • Jan 23rd, 2013
 

error: #include expects "FILENAME" or
error: expected identifier or { before } token

#include

void main()
{
int a=1;
if(a=1,3,5,6)
printf("good&a=%d",a);
else
printf("bad&a=%d",a);

}

//Output

good&a=1

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions