Pointer in C
Some C programming tasks are
performed more easily with pointers, and other tasks, such as dynamic memory
allocation, cannot be performed without using pointers. So it becomes necessary
to learn pointers to become a perfect C programmer. Let's start learning them
in simple and easy steps.
What is Pointer in C?
A data type for containing an address rather than a data value.In a generic sense, a “pointer” is anything that tells us where something can be found.
Declaration of Pointer
Variables
Example
int *ptr1;
float *ptr2;
ptr1 is a pointer to an int
value i.e., it can have the address of the memory location (or the first of
more than one memory locations) allocated to an int value
ptr2 is a pointer to a float
value i.e., it can have the address of the memory location (or the first of
more than one memory locations) allocated to a float value















No comments:
Post a Comment