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
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Why does the call char scanf work?
How can I make sure that my program is the only one accessing a file?
how can I convert a string to a number?
Is fortran still used in 2018?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
How macro execution is faster than function ?
What do you mean by scope of a variable in c?
Why shouldn’t I start variable names with underscores?
What is c mainly used for?
What are the advantages and disadvantages of pointers?
Why should I prototype a function?
What is the difference between ++a and a++?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Here is a neat trick for checking whether two strings are equal