Home > Back-end >  Beginners ask you a question: using pointer, in a one-dimensional array element of int a [10], for a
Beginners ask you a question: using pointer, in a one-dimensional array element of int a [10], for a

Time:10-12

Your own code output data, please feel free to comment, thank you,
#include
Int order (int * a, int n);
Int main ()
{
Int a [10], * p, b;
P=a;
Puts (" please enter the ten integer ");
for(int i=0; i<10; I++)
{
The scanf (" % d ", a + I);
}
Puts (" enter a number to find ");
The scanf (" % d ", b);
Order (p, b);
return 0;

}
Int order (int * a, int n)
{int b=0, I;
for(i=0; i<10; I++)
{
If (* (a + I)==n)
{b=1;
break;
}

}
If (b==0)
{
Printf (" no ");
}
The else
{
Printf (" % d ", * (a + I));
}


}

CodePudding user response:

The scanf (" % d ", b);
Add & amp;
no.The scanf (" % d ", & amp; b);
  • Related