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

Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use two nested loops.

12 Answers   MIT, TCS,


Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


give an example of type casting by a simple c program

2 Answers   TCS,


Why is c known as a mother language?

0 Answers  


There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?

5 Answers   Microsoft, TCS,






write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

1 Answers   iGate, Shashi, Source Bits, Subex,


Explain what is wrong with this statement? Myname = ?robin?;

0 Answers  


#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

0 Answers  


How can variables be characterized?

0 Answers  


What is an object?

5 Answers  


Are enumerations really portable?

0 Answers  


How we can write a value to an address using macro..?

0 Answers   Tata Elxsi,


Categories