Pointer in C
- The pointer in C language is a variable, it is also known as locator or indicator that points to an address of a value.
Advantage of pointer
- Pointer reduces the code and improves the performance, it is used to retrieving strings, trees etc. and used with arrays, structures and functions.
- We can return multiple values from function using pointer.
- It makes you able to access any memory location in the computer's memory.
Usage of pointer
- There are many usage of pointers in c language.
1. Dynamic memory allocation
- In c language, we can dynamically allocate memory using malloc() and calloc() functions where pointer is used.
2. Arrays, Functions and Structures
- Pointers in c language are widely used in arrays, functions and structures. It reduces the code and improves the performance.
Symbols used in pointer
Address Of Operator
- The address of operator '&' returns the address of a variable. But, we need to use %u to display the address of a variable.