main()
{
int i=400,j=300;
printf("%d..%d");
}
Answers were Sorted based on User's Feedback
Answer / arun raj
Hi Surenda,
I think the answer is a garbage value.. i tried in gcc &
visual studio.. but i got garbage n both the case.. can u
tell which compile u compiled & got this output.
Regards
Arun Raj
| Is This Answer Correct ? | 15 Yes | 2 No |
Answer / laienjam rosan singh
In doing so, the values of i and j will be inserted into
the stack and at the time of displaying the values, LIFO
order is followed. For example in this question 400 is
inserted first and 300 second bcos i=400 is declared first.
But at the time of displaying on the screen using printf,
300 will come first as it follows LIFO. Again it is
important to note down that printf will display only the
two uppermost values in the stack in LIFO order as
default.If the code is modified as
main()
{
int i=400,j=300,k=500;
printf("%d..%d");
}
then the output is 500..300.It is because of the fact that
printf take only two uppermost values from the stack LIFO
order to be displayed on the screen.
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / ifti/amir/shah
300..400
i.e second no and the first...........
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / manju
answer is garbage value because in printf statement there
are no variables(i,j).
| Is This Answer Correct ? | 8 Yes | 3 No |
Answer / ravi
its machine Dependent
it displays garbage values in Linux
in some machines it will display 400 300
as they are on the top of stack
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / surenda pal singh chouhan
400..300
Explanation:
printf takes the values of the first two assignments of the
program. Any number of printf's may be given. All of them
take only the first two values. If more number of
assignments given in the program, then printf will take
garbage values.
| Is This Answer Correct ? | 8 Yes | 7 No |
Answer / preshit
output will b garbage value
because no variables are passed in last sentence.
| Is This Answer Correct ? | 5 Yes | 4 No |
Answer / sunil samal
300..400 because it will execute right to left .
when the printf () execute it will first execute from right to
left...
regards
sunilsamal@live.com
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pritam
Answer:
400..300
Explanation:
printf takes the values of the first two assignments of the
program. Any number of printf's may be given. All of them
take only the first two values. If more number of
assignments given in the program,then printf will take
garbage values.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is Full Form of C and Why We use C
What is an endless loop?
for (i <= 5 && i >= -1;++i; i > 0) { printf("%d ", i); }
/*program to calculate hra,da in salary if salary less than 10000 then hra15%,da13% otherwise hra20%,da18%/*
Which is the best website to learn c programming?
Which sorting algorithm is the best?
Is r written in c?
what is structuer?
What are volatile variables in c?
"I LOVE MY COUNTRY" write a c program to get "COUNTRY MY LOVE I" as the output. Use any other programming language. It is not mandatory to use C.
11 Answers ABC Infotech, ADP, College School Exams Tests, Kovair,
How can I manipulate strings of multibyte characters?
Function shall sum members of given one-dimensional array. However, it should sum only members whose number of ones in the binary representation is higher than defined threshold (e.g. if the threshold is 4, number 255 will be counted and 15 will not) - The array length is arbitrary - output the results to the stdout