Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


main()
{
int i=400,j=300;
printf("%d..%d");
}

Answers were Sorted based on User's Feedback



main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / ifti/amir/shah

300..400
i.e second no and the first...........

Is This Answer Correct ?    7 Yes 1 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / manju

answer is garbage value because in printf statement there
are no variables(i,j).

Is This Answer Correct ?    8 Yes 3 No

main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / preshit

output will b garbage value
because no variables are passed in last sentence.

Is This Answer Correct ?    5 Yes 4 No

main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

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

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / shanky

it will give error

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

Explain how can you check to see whether a symbol is defined?

0 Answers  


what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.

6 Answers   HCL,


Explain high-order bytes.

0 Answers  


What are the 5 types of inheritance in c ++?

0 Answers  


what is the difference between structural,object based,object orientd programming languages?

1 Answers   PanTerra,


What is volatile in c language?

2 Answers   HCL, TCS,


what information does the header files contain?

6 Answers   BSNL, Cisco, GDA Technologies,


what is the associativity of bitwise OR operator?

1 Answers  


What is const volatile variable in c?

0 Answers  


What is a segmentation fault?

2 Answers  


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

0 Answers  


write a program to find a given no. is divisible by 3 or not without using any arthimetic operators?

3 Answers   Broadcom, TCS,


Categories