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

How can you increase the size of a dynamically allocated array?

636


C program to find all possible outcomes of a dice?

1843


What is the difference between the expression “++a” and “a++”?

642


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

670


What is typeof in c?

596






What is ## preprocessor operator in c?

605


How many parameters should a function have?

657


Which control loop is recommended if you have to execute set of statements for fixed number of times?

803


what is recursion in C

601


Can you please explain the difference between malloc() and calloc() function?

609


What is a void pointer in c?

599


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

770


Explain b+ tree?

614


Explain how can type-insensitive macros be created?

564


Is c dynamically typed?

659