#include <stdio.h>
#define N 100
int main()
{
int n,c,d,a[N],b[N];
printf("Insert elements numbers in the array\n");
scanf("%d ", n);
printf("Insert the elements in the array\n");
for (c = 0; c < n ; c++)
scanf("%d", a[c]);
for (c=n-1,d = 0;d < n; c--,d++)
b[d]= a[c];
for(c = 0; c <n; c++)
a[c] = b[n];
printf("The array inverted is\n");
for(c=0; c<n;c++)
printf("%d\n",a[c]);
return 0;
}
爲什麼會崩潰?我試過,即使有值(N < 100),但仍然崩潰,我不知道如何解決它?有人能幫助我嗎 ?謝謝 !爲什麼會崩潰? (緩衝區溢出)
'的scanf( 「%d」,N);'必須是'的scanf( 「%d」,&n);' –
'一個並[c] = b [n];'? – BLUEPIXY