C | Operators | Question 8

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h>
int main()
{
    //Assume sizeof character is 1 byte and sizeof integer is 4 bytes
    printf("%d", sizeof(printf("GeeksQuiz")));
    return 0;
}

chevron_right


(A) GeeksQuiz4
(B) 4GeeksQuiz
(C) GeeksQuiz9
(D) 4
(E) Compile-time error


Answer: (D)

Explanation: An expression doesn’t get evaluated inside sizeof operator. GeeksQuiz will not be printed. printf returns the number of characters to be printed i.e. 9 which is an integer value. sizeof operator returns sizeof(int).

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


2


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