+ 1
Explain statement 2 and 3 in the given c++ code?
#include <iostream.h> #include<conio.h> int main() { clrscr(); static int a[]={0,1,2,3.4}; int *p[]={a,a+1,a+3,a+4}; //statement 2 int **ptr=p; //statement 3 ptr++; cout<<ptr-p<<*ptr-a<<**ptr<<endl; *ptr++; cout<<ptr-p<<*ptr-a<<**ptr<<endl; ++*ptr; cout<<ptr-p<<*ptr-a<<**ptr<<endl; getch(); }
1 Answer
- 1
statement 2 is array of pointer and statement 3 is chain of pointer (pointer to pointer).