Demonstrate the size of pointer - C - A6P6



/* Write a program that demonstrate the size of pointer */

#include<stdio.h>
#include<conio.h>
void main()
{
    int len;
    char ch='v';
    char *str1;
    int a=25,*b=&a;
    float c=25.50,*d=&c;
    clrscr();

    str1=ch;
    len=sizeof(ch);
    printf("size of char variable            -> %d ",len);
    len=sizeof(*str1);
    printf("\nsize of CHAR pointer variable  -> %d ",len);
    len=sizeof(a);
    printf("\nsize of INT variable           -> %d ",len);
    len=sizeof(*b);
    printf("\nsize of int pointer variable   -> %d ",len);
    len=sizeof(c);
    printf("\nsize of float variable         -> %d ",len);
    len=sizeof(*d);
    printf("\nsize of float pointer variable -> %d ",len);

    getch();
}

Post a Comment