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

Answers were Sorted based on User's Feedback



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

Answer / manjunath a s

it will be in infinite loop because x=6 is an assignment
statement and it will be always true.

Is This Answer Correct ?    1 Yes 6 No

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

Answer / vikraman85

compile time err wil occur..
Have 2 use == opr..

Is This Answer Correct ?    3 Yes 11 No

Post New Answer

More C Interview Questions

x=2,y=6,z=6 x=y==z; printf(%d",x)

13 Answers   Bharat, Cisco, HCL, TCS,


How can I make it pause before closing the program output window?

1 Answers  


How do we make a global variable accessible across files? Explain the extern keyword?

1 Answers  


Write a program for Overriding.

1 Answers  


What is the size of empty structure in c?

1 Answers  


In which language linux is written?

1 Answers  


Which is better pointer or array?

1 Answers  


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

1 Answers   Google,


How can I delete a file?

1 Answers  


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

1 Answers   HCL,


HOW TO FIND OUT THE RREVERS OF A GIVEN DIGIT NUMBER IF IT IS INPUT THROUGH THE KEYBORD BY USING C LANGUAGE

3 Answers   Wipro,


palindrome for strings and numbers----Can anybody do the prog?

6 Answers   CTS, TCS, Vipro Lifescience Pvt,


Categories