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
Is null always defined as 0(zero)?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
Explain about the functions strcat() and strcmp()?
What are formal parameters?
Explain how do you override a defined macro?
What is the difference between constant pointer and constant variable?
What is the use of #include in c?
What is difference between structure and union in c programming?
What are enumerated types?
Write a program to use switch statement.
What are the two types of functions in c?
differentiate built-in functions and user – defined functions.
What is infinite loop?
What is an endless loop?
Explain how does flowchart help in writing a program?