C Quiz – 101 | Question 2

Assume int is 4 bytes, char is 1 byte and float is 4 bytes. Also, assume that pointer size is 4 bytes (i.e. typical case)

filter_none

edit
close

play_arrow

link
brightness_4
code

char *pChar;
int *pInt;
float *pFloat;
  
sizeof(pChar);
sizeof(pInt);
sizeof(pFloat);

chevron_right


What’s the size returned for each of sizeof() operator?
(A) 4 4 4
(B) 1 4 4
(C) 1 4 8
(D) None of the above


Answer: (A)

Explanation: Irrespective of the type of pointer, the size for a pointer is always same. So whether it’s pointer to char or pointer to float, the size of any pointer would be same. Even size of a pointer to user defined data type (e.g. struct) is also would be same.

Quiz of this Question

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 :


Be the First to upvote.


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