具有以下代码:
#include <stdio.h>
#include <stdlib.h>
struct Test { char c; } foo;
int main (void) {
struct Test *ar[10];
struct Test *(*p)[] = &ar;
*(*p+1) = &foo; // the same (*p)[0] = &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 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]
.