What is the output of the following C program?Main(){Printf("%c","abcdefgh"[4]);}

This question is related to Oracle Interview

Showing Answers 1 - 14 of 14 Answers

varun

  • Jul 3rd, 2005
 

ans:efgh

  Was this answer useful?  Yes

venkat

  • Jul 29th, 2005
 

guess varun got it wrong.. 
note that we have a %c and not a %s. 
therefore it has to print only e.

iyyswarya

  • Nov 29th, 2005
 

why shoul it print only e and not any other variable in the given input?

nilesh

  • May 3rd, 2006
 

I think the o/p will be e.

Neo

  • Aug 14th, 2006
 

Assuming that there r no syntax errorsThe o/p will be e

  Was this answer useful?  Yes

mahender

  • Oct 13th, 2006
 

The answer is e.

  Was this answer useful?  Yes

Raja

  • Feb 12th, 2007
 

e

  Was this answer useful?  Yes

maddy27

  • Apr 2nd, 2010
 

The answer is "e" because the value "abcdefgh" will get one index for each letter as:

a=0
b=1
c=2
d=3
e=4
f=5
g=6
h=7

And since %c is written in question der4 only one letter will be our answer... and is "e" coz its index is 4.


  Was this answer useful?  Yes

Avatik

  • Oct 29th, 2023
 

A=0,b=1,c=2,d=3,e=4,f=5,g=6,h=7 ;
So,4 is e
Ans=e

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions