what will be printed by this printf?
printf("%c",printf("hi")["sharkselva"]));
}
Answers were Sorted based on User's Feedback
Answer / 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 |
what is the c source code for the below output? 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1
Linked lists -- can you tell me how to check whether a linked list is circular?
develop algorithms to add polynomials (i) in one variable
How many data structures are there in c?
Why we use conio h in c?
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
what r the cpu registers r ther?
how to find the given number is prime or not?
C passes By value or By reference?
5 Answers Geometric Software, Infosys,
What is this infamous null pointer, anyway?
string reverse using recursion
is c language is a object oreinted language?