Right Click to Search

Monday, January 25, 2025

What is the size of Pointer variable in C ?


What is the size of Pointer variable in C ?

Pointer  : 
Pointer is the variable that stores the address of another variable .

How to calculate size of Pointer ? 
  1. Size of Pointer can be evaluated by using sizeof operator
  2. Pointer stores the address of the Variable .
  3. Address of variable is nothing but the integer value .
  4. In C , for storing integer value 2 bytes are required .
  5. So Pointer variable requires 2 bytes of memory.


int main(void)
{
  int num = 0;
  int *ptr = NULL;
  num = 15;
  ptr = #
  /* Output the size   */
 printf("Size of Pointer : %d Bytes",sizeof(pointer));
  return 0;
}


Output :
 Size of Pointer : 2 Bytes

Bookmark & Share

Tags / Keywords : | , ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates