稚内天气预报15天:a rub in c program

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/04 16:30:22
#define MAX 10
int a[MAX],i;
main()
{printf("\n");sub1();sub3(a);sub2();sub3(a);
}
sub2()
{int a[MAX],i,max;
max=5;
for(i=0;i<max;i++) a[i]=i;
}
sub1()
{for(i=0;i<max;i++) a[i]=i+i;
}
sub3(int a[])
{int i;
for(i=0;i<MAX;i++) printf("%d",a[i]);
printf("\n");
}
what's result of this c program?why are just two lines of numbers printed on the screen rather than four lines according to the four variations?
Explicit explanation is a necessaty.Expect your response.

why not?
only sub3() called printf function, printing out one line of numbers ..
you called sub3 twice, not four.

what did you mean by "four variations"?