#include <stdio.h>
#define MAX_LEN 20
int main() {
char a[MAX_LEN]="hello";
char *ptr=a;
printf("%s",ptr);
printf("\nsize of ptr = %ld",sizeof(ptr));//just the size of pointer//this is not value
printf("\nsize of *ptr = %ld",sizeof(*ptr));//just sz of char//this one is not address of pointer
int b=10;
int *pt=&b;
int *p=&b;
int c=25;
pt=&c;
pt=p;//value will be copied
printf("\nsize of pt = %ld",sizeof(pt));
*pt=*p;//address od pointer will be copied
printf("\nsize of *pt = %ld",sizeof(*pt));
/*here we use *pt to change the value or take value
of the value of str or int
* in *pt acts as a key to a loacker(value pt) */
printf("\n%d",*pt);
}
/*
why used % ld in size of int,double,float program?
The sizeof() operator returns a long unsigned integer so the correct format
specifier is %lu.
%ld is for signed long integers (which can have a negative value).
The return value of sizeof() is either 0 or some positive value, never negative.
*/
To embed this program on your website, copy the following code and paste it into your website's HTML: