Skip to main content

pointers in c

#include<stdio.h>
int main()
{
    int a=27;
    int *ptr = &a;
    int *ptr1=NULL;
    printf("The value of a is %d\n",a);
    printf("The value of a is %d\n",*ptr);
    printf("The address of a is %p\n",&a);
    printf("The address of a is %p\n",ptr);
    printf("The address of ptr is %p\n",&ptr);
    printf("The value of some garbage is %p\n",ptr1);
    printf("The address of some garbage is %p\n",&ptr1);
    return 0;
}

Comments