要定义一个类型 class,其是10层结构的阵列.要使用此类型,您必须实例化该类型的变量:
class x;
x[0].age = 10;
Run Code Online (Sandbox Code Playgroud)
也许稍微更简洁的方法是拥有两个独立的typedef:
typedef struct { int roll; int age; } foo_unit;
typedef foo_unit foo_array[10];
foo_array x; /* now an array of 10 foo_units. */
foo_unit y[10]; /* same thing */
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
151 次 |
| 最近记录: |