What is pointer? Explain the meaning of each of the following declaration.

What is pointer? Explain the meaning of each of the following declaration.

  1. int*p;
  2. int *p[10];
  • int(*) [10]
  1. int*p[void];
  2. 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:

  1. Int*p;= a pointer that will point to a integer data.
  2. 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.
  1. Int*p[void];= p is function that return a pointer to a integer data.
  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *