程序在VS 2017中输出的结果为什么是这样的?求助大神!谢谢!
#include <stdio.h>int fun(int lim, int aa[])
{
int i, j = 0, k = 0;
for (i = 2; i < lim; i++)
{
for (j = 2; j < i; j++)
{
if (i%j == 0)
break;
if (j == i)
aa[k++] = i;
}
}
return k;
}
int main()
{
int aa[100], i;
fun(100, aa);
printf("100以内的素数有:\n");
for (i = 0; i < 25; i++)
{
printf("%d\t", aa[i]);
}
printf("\n");
system("pause");
return 0;
}
VS 2017的输出结果:
100以内的素数有:
-858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460
-858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460 -858993460
请按任意键继续. . .