Course Content
History of C Language
0/2
Basic Structure of C Program
0/1
Types of Errors
0/1
Language Fundamentals
0/1
Data Types and Modifiers
0/1
Programming with C Language
About Lesson

NULL Pointer

A pointer that is assigned NULL is called a null pointer.

#include

void main()

{

    int a=10;

    int *pa;

    pa=&a;

    printf(“address of a is %d”,pa);

    printf(“nvalue at a is %d”,*pa);

    pa=NULL;

    printf(“nn”);

    printf(“address of a is %d”,pa);

    printf(“nvalue of a is %d”,*pa);

}

Pointer to a Pointer

A pointer can hold the address of another pointer variable.  Then it will be called as pointer to pointer.

/* Program that declares a pointer to a pointer */

# include

void main( )

{

int i = 100;

int *pi;

int **pii;

pi = &i;

pii = π

printf (“Address of i = %u n”, &i);

printf (“Address of i = %u n”, pi);

printf (“Address of i = %u n”, *pii);

printf (“Address of pi = %u n”, &pi);

printf (“Address of pi = %u n”, pii);

printf (“Address of pii = %u n”, &pii);

printf (“Value of i = %d n”, i);

printf (“Value of i = %d n”, *(&i));

printf (“Value of i = %d n”, *pi);

printf (“Value of i = %d”, **pii);

}

You cannot copy content of this page