编译通过,运行崩溃
#include<stdio.h>#include<stdlib.h>
int main(void)
{
int n,a=0,b=0,c=0,d=0,e=0,i;
int *p;
scanf("%d",&n);
p=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
{
scanf("%d",p[i]);
switch(p[i]/10)
{
case 10:
case 9:a++;break;
case 8:b++;break;
case 7:c++;break;
case 6:d++;break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:e++;break;
default:break;
}
}
printf("%d %d %d %d %d",a,b,c,d,e);
free(p);
return 0;
}
以上是代码。求指正