請給你的有關數組越界的觀點....如果IM服用大陣列輸出20數組大小....打印垃圾值C編程數組索引越界
#include<stdio.h>
int main()
{
int message[200],i,j,n,count,temp;
count=0;
scanf("%d",&n);
//input taking line
for(i=1; i<=n; i++)
scanf("%d",&message[i]);
for(i=1; i<=n; i++)
{
if(message[i]==1)
{
count+=1;
}
if(message[i]==0)
count=0;
if(count==5)
{
count=0;
temp=message[i+1];
message[i+1]=0;
//n=n+1;
//n1=n;
for(j=(n); j<(i+2); j--)
{
message[j+1]=message[j];
}
n++;
message[i+2]=temp;
}
}
printf("line\n");
//n1+=1;
for(i=0; i<n; i++)
{
printf("%d\n",message[i]);
}
//n1+=1;
return 0;
}
正確的位感謝您的幫助...
顯示您的輸入。 – BLUEPIXY