0
Please explain Why the answer is 4 here?
printf("%d", sizeof(printf("GeeksQuiz")));
4 Respostas
+ 3
the printf(GeeksQuiz") return the count of chars in the string as an int, and the size of an int is 4.
+ 2
This is memory allocation, not element size!
int main() {
printf("%lu", sizeof(char));
printf("%lu", sizeof(int));
printf("%lu", sizeof(float)) ;
printf("%lu", sizeof(char));
}
Will output:
1448
%lu is unsigned decimal (long)
0
NO!
The answer would be COMPILE TIME-ERROR.
Because An expression doesn’t get evaluated inside the size of 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).