main()
{
printf(5+"good morning");
printf("%c","abcdefgh"[4]);
}the o/p is morning and e...how someone explain



main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }th..

Answer / vignesh1988i

the o/p depends upon the compiler and cant be predicted
wat's hapenning inside .... each will have different
opinion.....my opinion is :
here in the first printf statement "good morning" acts as
an string and 5+"good morning" means print the string
after the 5th character in the string starting from 0....
so o/p is :
morning

for second one :

this printf can be re-written as the first printf statement
printf("%c",4+"abcdefgh");
here only the 4th character will get printed ... in this
case it will print 'e'..

thank u

Is This Answer Correct ?    26 Yes 11 No

Post New Answer

More C Interview Questions

plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>

1 Answers  


Write a program to add a given duration with time(24hrs format)

1 Answers   Protech,


Write a program in c to input a 5 digit number and print it in words.

11 Answers  


What is the difference between scanf and fscanf?

0 Answers  


How can type-insensitive macros be created?

0 Answers  






What does a pointer variable always consist of?

0 Answers  


What does %f mean c?

1 Answers  


write a c program to check weather a particluar bit is set or not?

5 Answers   IBM,


who developed c and why he developed c?

5 Answers  


What is function prototype?

0 Answers  


how could explain about job profile

0 Answers  


what is the difference between auto and static keywords

1 Answers   cDot, College School Exams Tests, TCS,


Categories