移动数组元素问题
请各位看一下这个简单的程序,,运行出错了,哪位指点一下,错在什么地方.#include <stdio.h>
Move(int number[20], int n, int m);
int main()
{
int number[20],n,m,i;
printf("How many numbers?\n");
scanf("%d",&n);
printf("Input the %d numbers:\n",n);
for(i=0; i<n; i++)
scanf("%d",&number[i]);
printf("How many number do you want to move?\n");
scanf("%d",&m);
Move(number,n,m);
printf("Now they are:\n");
for(i=0; i<n; i++)
printf("%5d ",number[i]);
return 0;
}
Move(int array[20], int n, int m)
{
int *p, arrayEnd;
arrayEnd=*(p+n-1);
for(p=array+n-1; p>array; p--)
{
*p=*(p-1);
}
*array=arrayEnd;
m--;
if(m>0)
Move(array,n,m);
}