a=0;
b=(a=0)?2:3;
a) What will be the value of b? why
b) If in 1st stmt a=0 is replaced by -1, b=?
c) If in second stmt a=0 is replaced by -1, b=?
Answer Posted / ashwin kumar
3 is the answer
2nd guy says we can't use "=" it's wroung we can use it in
this condition .
expl:
1st it will check condition part , condition part will
return false as, ANY VALUE OTHER THAN ZERO TAKEN AS TRUE IN
C LANGUAGE , here we are assiging zero to 'a' which give
false.
from basic of above contion , it condition return false it
will execute or return 2nd statement, i.e 3
so out put will be 3
Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is the difference between if else and switchstatement
Explain high-order bytes.
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
Explain what does the format %10.2 mean when included in a printf statement?
Where is volatile variable stored?
What is the difference between typedef and #define?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the meaning of 2d in c?
What are valid operations on pointers?
What is .obj file in c?
code for quick sort?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
What is the difference between c and python?
What is difference between function overloading and operator overloading?
What is zero based addressing?