#include<stdio.h>
#include<math.h>
main( )
{ static int a[ ] = { 13, 1, 2, 3, 4 } ;
int *p[ ] = { a, a + 1, a + 2, a + 3, a + 4 } ;
printf ( “\n%u %u %d”, p, *p, * ( *p ) ) ;
#include<stdio.h>
#include<math.h>
main( )
{ static int a[ ] = { 13, 1, 2, 3, 4 } ;
int *p[ ] = { a, a + 1, a + 2, a + 3, a + 4 } ;
printf ( “\n%u %u %d”, p, *p, * ( *p ) ) ;
explain the output
I think your intention is this :-
#include < stdio.h>
#include < math.h>
int main( )
{
static int a[ ] = { 13, 1, 2, 3, 4 } ;
int \*p[ ] = { a, a + 1, a + 2, a + 3, a + 4 } ;
printf("\n%p %p %d", p, \*p, \*(*p)) ;
return 0;
}
When ever you declare an array ‘temp’. If you try to get value of ‘temp’ i.e; printf("%u",temp);
It gives base address of ‘temp’ and if you tried to get ‘*temp’ then you get contents in base address of ‘a’.
So using this approach,try to understand output :
p -> base address of p,
*p -> contents in base address of p i.e base address of a,
*(*p) ->contents in base address of a i.e 13
I hope this little explanation may understand.Still if you are uncomfortable comment below
thanks…
thanks…