What is the value of y in the following code?
x=7;y=0;
if(x=6)
y=7;
else
y=1;

Answer Posted / balaji jayakumar

y=7 because if condition doesnt fail... so the immediate
statement after if will be executed and 7 gets printed. It
is quite certain only if "if" fails else will be be opted
for. so y=7... no error statements will occur.. i have tried
it in c.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the usage of the pointer in c?

606


Once I have used freopen, how can I get the original stdout (or stdin) back?

628


Explain the array representation of a binary tree in C.

726


What does %c mean in c?

648


What is sorting in c plus plus?

565






What is calloc() function?

624


Differentiate between a structure and a union.

763


What are types of structure?

603


Does c have enums?

601


What are the 5 types of organizational structures?

549


Write a program for finding factorial of a number.

629


How arrays can be passed to a user defined function

579


How do I create a directory? How do I remove a directory (and its contents)?

604


can anyone please tell about the nested interrupts?

1677


how to build a exercise findig min number of e heap with list imlemented?

1612