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
How can you determine the maximum value that a numeric variable can hold?
What does != Mean in c?
Write a c program to demonstrate character and string constants?
What are the key features in c programming language?
What is a good data structure to use for storing lines of text?
Explain how do you use a pointer to a function?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
What is a constant?
How can I copy just a portion of a string?
Explain logical errors? Compare with syntax errors.
How can you pass an array to a function by value?
Is c# a good language?
Differentiate between new and malloc(), delete and free() ?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What is null in c?