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 |
Write a routine that prints out a 2-D array in spiral order!
i want to make a program in which we use input having four digits(4321) and get output its reciprocal(1234).
What is the use of the function in c?
what is difference between ++(*p) and (*p)++
17 Answers Accenture, HCL, IBM,
Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .
What is bubble sort in c?
What do you mean by keywords in c?
Why c is called a middle level language?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Difference between malloc() and calloc() function?
How can you invoke another program from within a C program?
How to delete a node from linked list w/o using collectons?