Pages

Write a program to show the size of char type variable and use of pointers in c language.

Friday, 19 April 2013


#include<stdio.h>
#include <stdlib.h>
int main()
{
char a, b, c, *p, *q, *r;
p = &a;
q = &b;
r = &c;
printf("adress of a is = %d \n",&a);
printf("adress of b is = %d \n",&b);
printf("adress of c is = %d \n\n",&c);
printf("adress of *p is = %p \n",p);
printf("adress of *q is = %p \n",q);
printf("adress of *r is = %p \n",r);
printf("size of a = %d bytes\n", sizeof(a));
printf ("Size of b = %d bytes\n",sizeof (b));
printf ("Size of c = %d bytes\n",sizeof (c));
printf ("Size of  *p = %p bytes\nSize of char *q = %p bytes\nSize of *r = %p bytes\n",sizeof (*p),sizeof (*q),sizeof (*r));

system("PAUSE");
return 0;

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *