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


Please Help Members By Posting Answers For Below Questions

What is the difference between if else and switchstatement

1313


Explain high-order bytes.

677


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

589


Explain what does the format %10.2 mean when included in a printf statement?

783


Where is volatile variable stored?

652






What is the difference between typedef and #define?

548


Explain how can a program be made to print the name of a source file where an error occurs?

691


What is the meaning of 2d in c?

613


What are valid operations on pointers?

670


What is .obj file in c?

649


code for quick sort?

1622


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.

1382


What is the difference between c and python?

586


What is difference between function overloading and operator overloading?

661


What is zero based addressing?

717