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 the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

1958


What is a null string in c?

588


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.?

628


What are formal parameters?

658


Write a progarm to find the length of string using switch case?

1612






How can I implement sets or arrays of bits?

605


What is the advantage of an array over individual variables?

742


C language questions for civil engineering

1239


What is "Hungarian Notation"?

637


hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?

1660


What is function prototype in c language?

612


1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if

3982


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

556


What is omp_num_threads?

582


What is assignment operator?

624