Home > Back-end >  Algorithm problem
Algorithm problem

Time:12-04

The inside of the * (a + j + 1)=* (a + j) and * (a + m) the two really don't understand, when a=4, 4 m 0 means that the output, m to 1 output 1, however, difficult,,


 # include & lt; Stdio. H> 
# include & lt; Stdlib. H>
# define M 4
A void fun (int *)
{
Int I, j, k, m, p;
For (I=M; I> 0; I -)
{
K=* (a + M - 1);
For (j=M - 1; J & gt;=0; J -) {
* (a + j + 1)=* (a + j);
}
* a=k;
For (m=0; mPrintf (" % d ", * (a + m));
printf("\n");
}
}
Int main () {
Int a [M]={1, 2, 3, 4};
Fun (a);
}

CodePudding user response:

* (a + j + 1)=* (a + j)

Like crossing the line, a * (a + 4)



* (a + m) is equivalent to a [m]

Mean to print a [0], a [1], a [2], a [3]

* (a +... ) you can use a [...] Replace

This should be well understood

CodePudding user response:

K=* (a + M - 1);//the last element of an array is assigned to the variable k
For (j=M - 1; J & gt;=0; J -) {
* (a + j + 1)=* (a + j);//loop moving back the elements of an array is a
}
* a=k;//array value of the first element is the original array now the last one
  • Related