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 / vaibhav

b=3
becoz in ternay operator if statement is true then it
returns non zero vaqlue othervise it return 0 in that case
we initialize the value of a is 0 therefore it will exicute
a else part

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a pragma?

671


What are the types of pointers in c?

531


What is #define used for in c?

616


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

630


What is the difference between scanf and fscanf?

665






What is void main ()?

614


What is printf () in c?

579


What is this pointer in c plus plus?

599


In c programming language, how many parameters can be passed to a function ?

632


Is fortran still used today?

605


What is the difference between local variable and global variable in c?

692


What is the difference between a free-standing and a hosted environment?

643


Are there any problems with performing mathematical operations on different variable types?

576


Multiply an Integer Number by 2 Without Using Multiplication Operator

324


What is chain pointer in c?

604