c语言程序求解(关于typedef)

来源:百度知道 编辑:UC知道 时间:2024/09/20 13:48:24
#include "stdio.h"
typedef int arr[10]
void main()
{
int i;
arr a;
for(i=0;i<=9;i++)
a[i]=i;
for(i=0;i<=9;i++)
printf("%d",a[i]);
getch();
}
说是语法错误 ,加上分号后显示“未定义的符号 '__STKLEN' 在模块 C0M”

加上;后,在VC6.0上运行正常,
输出结果为:
0123456789

#include<stdio.h>

typedef int arr[10];
void main()
{
int i;
arr a;
for(i=0;i<=9;i++)
a[i]=i;
for(i=0;i<=9;i++)
printf("%d",a[i]);
getch();
}

后面没加分号...

#include "stdio.h"
typedef int arr[10]; // lack ";"
void main()
{
int i;
arr a;
for(i=0;i<=9;i++)
a[i]=i;
for(i=0;i<=9;i++)
printf("%d",a[i]);
getch();
}

typedef int arr[10]
这句是要干嘛?按下面的代码直接int arr[10]不需要typedef