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

What are header files? What are their uses?

644


What is the advantage of a random access file?

644


What are the three constants used in c?

549


FILE PROGRAMMING

1781


What is #line in c?

565






Explain what standard functions are available to manipulate strings?

615


Is it valid to address one element beyond the end of an array?

677


What is the default value of local and global variables in c?

563


What are multibyte characters?

649


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2659


how to make a scientific calculater ?

1570


Explain what is the difference between text files and binary files?

622


What are the advantages of using macro in c language?

596


Give the rules for variable declaration?

682


Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.

3694