First statements in main
int a[3][3],i,j,k,n,m,vectorfound[100],p,foundmonth;
printf("Number of months: ");scanf("%d",&m);
printf("Number of customers: ");scanf("%d",&n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
{
printf("a[%d][%d]= ",i,j);scanf("%d",&a[i][j]);
}
The moment m
or n
is greater than 3
, you are in undefined behavior territory with a strong likelihood of crashing. Your a
array isn't big enough to hold anything bigger than a 3x3.
Also, your printf
statement inside the for-lopp is preceding the scanf
statement. Whatever gets printed is likely garbage data off the stack.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…