Hi,
i am confused while writing this program
Code:
#include<stdio.h>
typedef struct
{
int (*p)[3];
}can1;
void function1(can1 *ptr );
int main()
{
int array[2][3]=
{
{1,2,3},
{4,5,6},
};
can1 cand={&array};
function1(&cand);
return 0;
}
void function1(can1 *ptr )
{
printf("%d\n",(*ptr->p[1])[0]);
}
My explanation is something like this *(ptr->p[1]) is a pointer pointing to element 4 and *(ptr->p[1])[0] is the value at that address. But the compiler shows error. what is my mistake.
Thanks in advance,