Home > Back-end >  C language for beginners and problem sets, could write complicated. I don't know why appear pro
C language for beginners and problem sets, could write complicated. I don't know why appear pro

Time:01-04

#include
Int search (int a [], int n, int k)
{
Int I, f=1;
for(i=0; iIf (a [I]==k)
{
F=I; break;
}
Return the f;
}
Void delate (int a [])
{
Int j, I;
For (I=9. i> 0; I -)
If (a [I]==0)
For (j=I; J<10; J++)
A [j]=a, a + 1 bonus to [j].
}
Int main ()
{
Int a [10], b [10], c [20], I, j, k=0, the index=0;
for(i=0; i<10; I++)
The scanf (" % d ", & amp; A [I]);
for(i=0; i<10; I++)
The scanf (" % d ", & amp; B [I]);
for(i=0; i<10; I++)
for(j=i+1; J<10 - index; J++)
If (a==[I] a [j])
{a [j]=0;
Delate (a);
index++; }
K=10 - index;
for(i=0; iC=[I] a [I];
for(i=0; i<10; I++)
If (search (c, 20, b [I])==1)
{c [k] [I]=b; k++; }
for(i=0; iPrintf (" % d ", [I] c);
printf("\n");
return 0;
}

CodePudding user response:

Error message is clear, your source of 18 caused invalid memory references, is access to an array of crossing the line,

CodePudding user response:

 void delate (int a []) 
{
Int j, I;
For (I=9. i> 0; I -)
If (a [I]==0)
For (j=I; J<10-1; J++)
A [j]=a, a + 1 bonus to [j].
}
  • Related