Home > Back-end >  Design complete program to achieve the following functions: there are 10 elements to an array {,8,10
Design complete program to achieve the following functions: there are 10 elements to an array {,8,10

Time:09-19

O great god save the children, pointer, this is a really didn't learn, don't know where he is wrong,,
Int main ()
{
Int p, m, n, k, j.
,8,10,2 int a [N]={1, 5,0,7,15,4, 5};
ABC (a, & amp; P, & amp; M. & amp; N, & amp; K, & amp; J);
Printf (" maximum array cuhk and subscript: % d % d \ n ", m, j);
Printf (" the smallest value in the array and its subscript: % d % d \ n ", n, k);
return 0;
}
Int ABC (int * p, int * m, int * n, int * j, int * k, int a [])
{
int i;
P=a;
* m=* a;
* n=* a;
* p=* + + p;
For (; i<10; I++);
{
If (* p> * m)
M={* * p;
* j=I;
}
If (* p<* n)
{
* n=* p;
* k=I;
}
* + + p;
}
}

CodePudding user response:

There are a few hair
#include
# define N 10
Int ABC (int a [], int * p, m, int * int * n, int * j, int * k);
Int main ()
{
Int p, m, n, k, j.
,8,10,2 int a [N]={1, 5,0,7,15,4, 5};
ABC (a, & amp; P, & amp; M. & amp; N, & amp; K, & amp; J);
Printf (" maximum array cuhk and subscript: % d % d \ n ", m, j);
Printf (" the smallest value in the array and its subscript: % d % d \ n ", n, k);
return 0;
}
Int ABC (int * p, int * m, int * n, int * j, int * k, int a [])
{
int i;
P=a;
* m=* a;
* n=* a;
* p=* + + p;
For (; i<10; I++);
{
If (* p> * m)
M={* * p;
* j=I;
}
If (* p<* n)
{
* n=* p;
* k=I;
}
* + + p;
}
}