What is pointer? Explain the meaning of each of the following declaration.
- int*p;
- int *p[10];
- int(*) [10]
- int*p[void];
- int*p(char*a);
Pointer is a variable that store memory address of another variable. It is similar to other variable but it stores address in place of data.
For example, p=&a; here, p is pointer storing memory address of a.
Meanings of declared pointer statement are:
- Int*p;= a pointer that will point to a integer data.
- Int*p[10];= p is 10- element array of pointer to integer data.
- Int(*p)[10];= p is a pointer to a 10-element integer data.
- Int*p[void];= p is function that return a pointer to a integer data.
- Int*p[char*a]; = p is a function that accepts an arguments which is a pointer to a character and returns a pointer to an integer data.
Importance of pointer is:
- It allows us to pass variable, array, function, string and structure as function argument.
- Pointer is more in handling the data table.
- They increase the execution speed of program.
- Pointer reduces the length and complexity of a program.
- It supports dynamic memory allocation memory arguments.
- The use of a pointer array to character strings results in saving of data storage space in a memory.
Please follow and like us: