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 / mohamed ali
THE ANSWER IS
20 20 22 22
YOU HAVE THE 1ST 20 AS IT'S THE INITIAL VALUE
THEN YOU HAVE K++ .... HERE WE HAVE THE SAME VALUE OF K THEN
IT WILL BE INCREMENTED BY ONE .... SO YOU HAVE THE 2ND 20
AND THEN K WILL BE 21
THE THIRD YOU HAVE ++K .... WHICH MEANS THAT YOU WILL
INCREMENT THEN TYPE THE VALUE AND SINCE YOU HAVE NOW K=21
FROM PREVIOUS STEP (K++) SO THIS VALUE WILL BE INCREMENTED
BY ONE (K = 22 ) SO YOU HAVE THE THIRD VALUE 22
THEN YOU HAVE A SINGLE K WITH NO OPERATIONS SO ANOTHER 22
IF SOMEONE SEES THAT I'M WRONG PLZ CORRECT MY VIEW
THANKS
Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
What is a MAC Address?
What is the description for syntax errors?
What library is sizeof in c?
What are the differences between new and malloc in C?
What is the basic structure of c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What is the stack in c?
Write a C program linear.c that creates a sequence of
processes with a given length. By
sequence it is meant that each created process has exactly
one child.
Let's look at some example outputs for the program.
Here the entire process sequence consists of process 18181:
Sara@dell:~/OSSS$ ./linear 1
Creating process sequence of length 1.
18181 begins the sequence.
An example for a sequence of length three:
Sara@dell:~/OSSS$ ./linear 3
Creating process sequence of length 3.
18233 begins the sequence.
18234 is child of 18233
18235 is child of 18234
........ this is coad .... BUt i could not compleate it .....:(
#include
Explain what is wrong with this program statement?
What is page thrashing?
What will be the outcome of the following conditional statement if the value of variable s is 10?
Why do we use static in c?
Can the size of an array be declared at runtime?
What are the advantages of using linked list for tree construction?
The statement, int(*x[]) () what does in indicate?