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

explain what is a newline escape sequence?

768


Why header files are used?

740


Is a house a shell structure?

787


What will be your course of action for a push operation?

744


What is the use of extern in c?

740






Is c easy to learn?

648


Explain what is the benefit of using an enum rather than a #define constant?

833


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

1698


List some of the dynamic data structures in C?

896


Explain b+ tree?

729


Why do we write return 0 in c?

648


How can I rethow can I return a sequence of random numbers which dont repeat at all?

824


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1554


What is extern variable in c with example?

658


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

1693