Computer Science Questions and Answers: C-Programming (Pointer) Part - 12

1) What is a pointer?
A pointer is a dynamic variable that stores address of a data value in a program.

2) How is a pointer declared in a c program?
syntax: datatype * pointer name; Ex: int *p1,x=230;

3) Name the operators used in pointers?
* and & operators

4) How is a pointer initialized . give an ex.
Initializing a pointer means storing the address of the data variable in to a pointer. Ex: p1=&x;

5) What is meant by a pointer to an array?
A pointer to an array stores address of the 1st data element of the array. 
Ex: int *p1,a[4];
P1=a; or p1=&a[0];

6) If ptr is a pointer to an integer what is the meaning of an expression ptr++; ?
ptr++; will increment the pointer and will make the pointer store address of next data element in the array.

7) What is meant by an array of pointers?
An array of pointer means a pointer array where every individual data is a pointer variable that holds an address.
Ex: int*p1[10],a[10],b[10],c[10];
P1[0]=&a[0];
P1[1]=&b[0];
P1[2]=&c[0];

8) Is it possible to add two pointers?
No.