main()
{
printf(5+"good morning");
printf("%c","abcdefgh"[4]);
}the o/p is morning and e...how someone explain
Answer Posted / 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 View All Answers
What is a string?
Why is it that not all header files are declared in every C program?
Why does everyone say not to use gets?
Why enum is used in c?
Explain what does the function toupper() do?
How can I read in an object file and jump to locations in it?
What is a scope resolution operator in c?
How can you pass an array to a function by value?
Can you tell me how to check whether a linked list is circular?
What is the maximum no. of arguments that can be given in a command line in C.?
What is the scope of an external variable in c?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
Why #include is used in c language?
Explain what is the benefit of using const for declaring constants?
What kind of structure is a house?