Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Pointers of C

What is Pointer?
o Pointer is variable that hold address of another variable of same
data type, present in memory.
o It is a derived data-type which constructed with the primitive
data-type.
o The size of pointer variable is 2-Bytes for any data-type, The
pointer variable allow us to occupies the memory runtime.
o Pointer helps us to easily implement data structure
programming.
o While working with pointer we need two uniary operators.
i.e
1. & -> Address of operator
2. * -> Value at address operator
The pointer variable declared has syntax.
Syntax: <data-type>*<Variable name> an example int *p;
TYPES OF POINTERS

Function Pointer 06 01 Void Pointer

Dangling Pointer 05 02 NULL Pointer

Pointer to Pointer Wild Pointer


04 03
Void Pointer
o A pointer which is declared by the help
of “Void” keyword then it is called the
void pointer.
o It can hold any type of address.
o The size of void pointer is 2-Bytes.
o It is also known as generic pointer.

SYNTAX
Void * var-name;
NULL Pointer
o A pointer variable that is initialized
with the NULL value at the time of
pointer declaration is called NULL
pointer.
o The NULL pointer does not point to any
memory location.

SYNTAX
Data-type * var-name= <\0>;
Wild Pointer
o A pointer variable that is not initialized
with any address is called wild pointer.
o Also known as bad pointer because it
holds the address of random memory
location.

SYNTAX
Data-type * var-name;
Pointer to Pointer
o A pointer variable which holds the
address of another pointer variable is
called pointer to pointer.
o We can implement the pointer to
pointer operation upto 12 stages.

SYNTAX
** var-name;
Function Pointer
o A pointer variable that holds the
address of function is known as the
function pointer.

SYNTAX
Return-type (*var-name) ( );
Dangling Pointer
o A pointer variable that holds the
address of an inactive area location
then the pointer is called the dangling
pointer.

SYNTAX
*var-name;

You might also like