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
What are header files? What are their uses?
What is the advantage of a random access file?
What are the three constants used in c?
FILE PROGRAMMING
What is #line in c?
Explain what standard functions are available to manipulate strings?
Is it valid to address one element beyond the end of an array?
What is the default value of local and global variables in c?
What are multibyte characters?
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.
how to make a scientific calculater ?
Explain what is the difference between text files and binary files?
What are the advantages of using macro in c language?
Give the rules for variable declaration?
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.