Monday 1 April 2013

sizeof pointer


    void main()
{
printf(“sizeof (void *) = %d \n“, sizeof( void *));
    printf(“sizeof (int *)    = %d \n”, sizeof(int *));
    printf(“sizeof (double *)  = %d \n”, sizeof(double *));
    printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct unknown *));
    }
Answer   :
sizeof (void *) = 2
sizeof (int *)    = 2
sizeof (double *)  =  2
sizeof(struct unknown *) =  2
Explanation:
The pointer to any type is of same size.


Blog Author: Vijay Kumar

No comments:

Post a Comment