Having this code:
#include <stdio.h>
#include <stdlib.h>
struct Test { char c; } foo;
int main (void) {
struct Test *ar[10];
struct Test *(*p)[] = &ar; //what type of syntax is this *(*p)[]
*(*p+1) = &foo; // the same (*p)[1] = &foo
//this only works
p[0][1] = &foo //the same as *(*p+1)
////1error: invalid use of array with unspecified bounds
(*(*p+1)+1) = &foo // the same as p[1][1] = &foo
////2error: lvalue required as left operand of assignment
//HOW TO make assignment of p[1][1] = &foo and NOT p[0][1] ??
return 0;
}
I am getting 2 weird errors from trying to assign an address from struct to array of structs. I would like both error explanation and how to make the assignment (viz. code) to p[1][1]
.
EDIT: the same as
statements could be wrong. I just thought, they would be equally, if "normal" pointers (their type)