新人小白一个
用的是vs2019编译器
scanf_s==scanf哦
求三连啊~~~
(。・ω・。)ノ♡
#include <stdio.h>
void abb(int* p, int n)
{
int brr[100];
int m, a, b = 0, c, d;
printf("请输入m的值:");
scanf_s("%d", &m);
for (a = n - m; a <= n; a++)
{
brr[b] = *(p + a);
b++;
}
for (c = n - m; c >= 0; c--)
{
*(p + c + m) = *(p + c);
}
for (d = 0; d <= m - 1; d++)
*(p + d) = brr[d];
}
int main()
{
int n, i;
int arr[100];
printf("请输入n的值:");
scanf_s("%d", &n);
printf("请输入%d个整数:", n);
for (i = 0; i <= n - 1; i++)
scanf_s("%d", &arr[i]);
abb(arr, n);
for (i = 0; i <= n - 1; i++)
printf("%d ", arr[i]);
return 0;
}