WHAT WILL BE OUTPUT OF BELOW CODE . . AND PLEASE EXPLAIN HOW
IT COME ..
#include<stdio.h>
#include<conio.h>
void main()
{
int k=20;
printf("%d%d%d%d",k,k++,++k,k);
getch();
}
Answer Posted / anand
The answer should be 22212120
Arguments passed to the printf statement would get executed
from the right to left..
1. k = 20
2. ++k = 21 (Pre Increment)
3. k++ = 21 (Post Increment(k value now is 22))
4. k = 22
Thus the output : 22212120
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why n++ execute faster than n+1 ?
Explain how can I convert a number to a string?
What is conio h in c?
Explain do array subscripts always start with zero?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Where local variables are stored in c?
What are the features of c language?
What is a char c?
How to establish connection with oracle database software from c language?
How can you determine the maximum value that a numeric variable can hold?
How are structure passing and returning implemented?
What is the advantage of a random access file?
Is boolean a datatype in c?
Explain data types & how many data types supported by c?