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 |
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
Is null equal to 0 in sql?
Explain the binary height balanced tree?
How to Throw some light on the splay trees?
While(1) { } when this loop get terminate is it a infinite loop?
What is extern variable in c with example?
How many keywords are there in c?
How to avoid buffer overflow?
What is sizeof return in c?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What is meant by int fun const(int a, int b) { .... ... }
What do you mean by command line argument?