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 |
Explain the term printf() and scanf() used in c language?
What is a 'null pointer assignment' error?
#include <stdio.h> int main() { if ("X" <"x") printf("X smaller than x "); } my question is whats the mistake in this program? find it and please tell me..
accept character from keyboard untill the user presses the enter key.If the user enters any character other than upper case(A-Z)alphabets program should stop taking any input
In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?
What is key word in c language?
what do you mean by defining a variable in our c code?
What is the ANSI C Standard?
Can i use “int” data type to store the value 32768? Why?
What's wrong with the call "fopen ("c:\newdir\file.dat", "r")"?
WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N TIMES C COMES N TIMES D COMES N TIMES AND SO ON......... AT LAST UNTIL Z COMES N TIMES...............
Why string is used in c?