C | Input and Output | Question 4

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
// Assume base address of "GeeksQuiz" to be 1000
int main()
{
   printf(5 + "GeeksQuiz");
   return 0;
}

chevron_right


(A) GeeksQuiz
(B) Quiz
(C) 1005
(D) Compile-time error


Answer: (B)

Explanation:

printf is a library function defined under stdio.h header file. The compiler adds 5 to the base address of the string through the expression 5 + “GeeksQuiz” . Then the string “Quiz” gets passed to the standard library function as an argument.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.