I have executed a program and found the output.But I'm not satisfied about the working of the program.
o/p of the code:
1 1 1
2 2 2
3 3 3
3 4 4
I put the following code along with the query in the code.
#include <stdio.h>
#include <conio.h>
int main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf("%d",*ptr); //It displays me the output for the this line as -170 why?
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
}