what will be printed by this printf?
printf("%c",printf("hi")["sharkselva"]));
}
Answer Posted / vadivelt
Ans: hia
Reason is, in the below statement,
printf("%c",printf("hi")["sharkselva"]));
printf("hi") shall be executed first. and this printf will
return the value 2. ie., no of characters successfully
printed by printf()statement.
So in runtime, "printf("%c",printf("hi")["sharkselva"]));"
will print "hi" and after, the main printf shall be
replaced as "printf("%c",2["sharkselva"]));".
According to printf() implementation, printf("%c",2
["sharkselva"]));" has to print the value at the array, for
the index given ie., 2. So in the array index '2',
character 'a' is available.
Now a is printed.
So the total output will be -> hia
| Is This Answer Correct ? | 31 Yes | 1 No |
Post New Answer View All Answers
How can you restore a redirected standard stream?
What is anagram in c?
What is the value of c?
can we have joblib in a proc ?
Explain the array representation of a binary tree in C.
How to compare array with pointer in c?
Explain enumerated types in c language?
Do you know pointer in c?
Describe the difference between = and == symbols in c programming?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What are register variables in c?
all c language question
How can you pass an array to a function by value?
Explain why c is faster than c++?
What is #include cctype?