I came across this piece of code on the net.I simply dont understand whats going on here.
#include <stdio.h>
#include <math.h>
main()
{
int arr [ ][3] = {{11,12,13}, {21,22,23},{31,32,33},{41,42,43},{51,52,53}};
int I , j ;
int *p , (*q) [3], *r ;
p = (int *) arr ;
q = arr;
r = (int *) q ;
printf (" %u %u %d %d %d %d \n ", p, q, *p, *(r), *(r+1), *(r+2));
p++ ;
q++ ;
r = (int *) q ;
printf (" %u %u %d %d %d %d \n ", p, q, *p, *(r), *(r+1), *(r+2));
}
i understand that p and r are pointers,q is a pointer to an array,but what does p = (int *) arr ; mean?What purpose does this statement serve?
Aucun commentaire:
Enregistrer un commentaire