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

Answer Posted / sravan kumer

Answer is 455848 in 'Turbo C++'
because here gave 4 %d's but given variables to print are 3.
So here Turbo C++ will evaluate first 3 parameters given as
---> first i will be evaluated so i=5 because printf() evaluates from right to left.
---> then i-- is 5 because it is post decrement so 1st prints value and then increments i=4
---> then i++ is post increments so 1st prints i value i.e 4
and then it will be incremented to 5.
---> so it printf will print 455 but there is another %d ,printf will handle those with a garbage values i.e 848 here.
so answer is 455848.i.e 455 is common after that some garbage value will be printed.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are linked list?

615


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

1079


What do you mean by c what are the main characteristics of c language?

564


What is a program?

655


What are the advantages of external class?

588






Explain the use of 'auto' keyword

671


Explain how do you determine whether to use a stream function or a low-level function?

618


What is the usage of the pointer in c?

598


What is the use of parallelize in spark?

570


Why we use int main and void main?

533


What is break statement?

623


What is use of null pointer in c?

563


Differentiate between ordinary variable and pointer in c.

613


What is I ++ in c programming?

617


Which is better malloc or calloc?

645