void main()
{
int i=5;
printf("%d",i++ + ++i);
}

Answer Posted / vivers

There are two different questions..
in which its asking the result for

1)(i++ + ++i)
answer will be---> 12
"as addition will takes place from left to right
step1: i++ = 5;
step2: value of i will be updated before taking value of
another operand and hence i = 6;
step3: ++i = 7 as first increment will happen and then value
will be used.
final result: 5 + 7 = 12"

2) (i+++++i)
answer will be---> compile error
"because illegal combination of operators"


best of luck...

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are the different data types in c?

761


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1779


all c language question

1878


What are the types of data types and explain?

675


Disadvantages of C language.

664






Can you return null in c?

599


write a program fibonacci series and palindrome program in c

633


How do we open a binary file in Read/Write mode in C?

683


What are the different types of linkage exist in c?

615


What is advantage of pointer in c?

697


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

683


What is data structure in c and its types?

598


Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

5806


What do the functions atoi(), itoa() and gcvt() do?

726


I came across some code that puts a (void) cast before each call to printf. Why?

685