Home > Back-end >  [C language help] pointer is used to implement digital output grew up
[C language help] pointer is used to implement digital output grew up

Time:04-03

 # include & lt; Stdio. H> 
#include
Void min_print (int * p, int n)//incoming is the address of the storage array
{
Int TMP=* p, I, j;
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//the value of an array of growing up is assigned to a pointer to the value of the

for(i=0; i{
for(j=0; j{
If (* p>=* (p + 1))
{
TMP=* p;
* p=* (p + 1);
* (p + 1)=TMP;
p++;
}
Else if (* p<* (p + 1))
{
p++;
}
}
}
//printf (" % d % d % d % d % d \ n ", * p, * (p + 1), * (p + 2), * (p + 3), * (p + 4));
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for(i=0; i{
Printf (" % d ", * p).
p++;
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void main ()
{
//the number of input digital
int n;
Printf (" both Please enter the number of who: \ n ");
The scanf (" % d ", & amp; N);
//input array
Int arr [n].

Printf (" do enter Numbers: % d \ n ", n);
for(int i=0; i{
The scanf (" % d ", & amp; Arr [I]);
}
Getchar ();

//an array of addresses to p
Int * p;
P=arr.
//
//printf (" * (p + 1)=% d \ n ", * (p + 2));
Min_print (p, n);
}




The output result is like this:

Trouble you help have a look at, thank you!
  • Related