#include<stdio.h>
#include<string.h>
int main(void)
{
typedef char Line[81];//define a new type,which is an char-type array,including 81 elements
Line text= {0x01,0x02,0x03,0x04};
printf("print:%d\n",sizeof(text));//the result is 81
for(char i=0; i<81; i++)
{
printf("the %dth element is:%d\n",i,text[i]);
}
return 0;
}
测试代码如上,使用typedef定义了一个数组类型的数据类型Line[81],接着使用该数据类型定义一个变量text,然后使用printf将数组大小、数组数据打印出来,结果如下