将数组中有n个整数 要求把下标p的数组元素平移到数组最后
例子:1,2,3,4,5,6,7,8,9,10;
p的值为3,则结果为 5,6,7,8,9,10,1,2,3,4;
代码:
#include <stdio.h>
#define N 80
void fun(int *w, int p, int n)
{
int i, j, ch;
for (i = 0; i <= p; i++)
{
ch = w[0];
for (j = 1; j < n; j++)
{
w[j - 1] = w[j];
}
w[n - 1] = w[i];
}
}
void main(