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 an array? What the different types of arrays in c?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
What are the 4 types of functions?
how to create duplicate link list using C???
Explain modulus operator. What are the restrictions of a modulus operator?
What is header file in c?
If errno contains a nonzero number, is there an error?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
Write a program to reverse a given number in c language?
How arrays can be passed to a user defined function
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
How do you search data in a data file using random access method?
Explain how can you restore a redirected standard stream?
Why we use void main in c?
What is the difference between abs() and fabs() functions?