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

Answer Posted / piyush

its looks logically incorrect,but in c anc c++ if any such
incident occurs like if(x=6), this condition is always
treated as true

will give a warning ,but will execute this as considering
the if condition as true

ANSWER to this question is y=7

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the scope of static variables in c language?

625


Explain spaghetti programming?

682


What is the use of gets and puts?

599


What are the different types of C instructions?

673


what type of questions arrive in interview over c programming?

1551






Why is python slower than c?

600


What is %d called in c?

755


What does char * * argv mean in c?

622


What are the functions to open and close file in c language?

725


Tell us something about keyword 'auto'.

659


Explain what is the difference between functions getch() and getche()?

604


Explain setjmp()?

652


What is the difference between ++a and a++?

689


i want to know the procedure of qualcomm for getting a job through offcampus

1933


Why can't I perform arithmetic on a void* pointer?

635