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

Answer Posted / gg

Ans: 7

Coz all non-zero statements are treated as true.
code can be written as..

if(TRUE)/*x=6 is a non-zero*/
Y=7;
else
y=1;

Note: To compare,have to use '==' operator.'=' is an
assignment operator.

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is formal argument?

649


What is the use of #define preprocessor in c?

615


Which are low level languages?

636


How macro execution is faster than function ?

666


Compare array data type to pointer data type

600






How pointers are declared?

560


How can I direct output to the printer?

812


What is the method to save data in stack data structure type?

606


What is the stack in c?

718


What are the advantages of Macro over function?

1199


What is unsigned int in c?

557


What is a macro?

656


what do the 'c' and 'v' in argc and argv stand for?

645


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

622


What is this pointer in c plus plus?

594