<(>令牌之前的预期标识符

Vla*_*nko 2 c

这段代码出了什么问题?

#include "stdio.h"

typedef int type1[10];

typedef type1 *type2;

typedef struct {
    int field1;
   type2 field2;
} type3;

typedef type3 type4[5];

int main() {    
   type4 a;
   a[0].(*field2[3]) = 99;  // Line 16
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

获取:main.c:16:10:错误:在<(>令牌之前)的预期标识符

Gcc版本:gcc(GCC)4.7.2

小智 6

编译器错误告诉您究竟出了什么问题:

<:>令牌之前的预期标识符

您只能使用其名称(标识符)访问结构成员,而不能使用某些任意表达式.