Open In App
Related Articles

C Quiz – 101 | Question 2

Improve Article
Improve
Save Article
Save
Like Article
Like

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)




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


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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Similar Reads