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


Please Help Members By Posting Answers For Below Questions

Why is c fast?

606


What is the purpose of macro in C language?

662


how to construct a simulator keeping the logical boolean gates in c

1730


What does 3 mean in texting?

617


Why do we need arrays in c?

584






Is c# a good language?

611


What are the types of pointers in c?

530


Explain why can’t constant values be used to define an array’s initial size?

856


How would you rename a function in C?

622


What is %g in c?

620


What are pointers? What are stacks and queues?

580


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

1498


What are inbuilt functions in c?

560


What is merge sort in c?

645


What's a good way to check for "close enough" floating-point equality?

628