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
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What is this pointer in c plus plus?
I need previous papers of CSC.......plz help out by posting them.......
Why #include is used in c language?
What is #pragma statements?
Can a void pointer point to a function?
what type of questions arrive in interview over c programming?
Can we declare variable anywhere in c?
What library is sizeof in c?
What is the function of multilevel pointer in c?
What is c++ used for today?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
What are the disadvantages of external storage class?
Explain how do I determine whether a character is numeric, alphabetic, and so on?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.