1, an array of n integers, so that it moves backward in the order of the first number of M position, the last m number to move to the front
1 /*########################################################################################################### #######2 #3 # An array of n integers, which moves the previous number in the Order of M, and the last m number to the front4 #5 ########################################################################################################## #########*/6 7#include"stdio.h"8#include"stdlib.h"9 Ten #defineN 10 One A voidMoveint*a,intNintm) - { - int*p,*q;//*p, *q pointer variable the intTemp//Zero Variable - - for(p=a+n-m; p<a+n; p++) - { +temp=*p; - + for(q=p-1; q>=p+m-n; q--) A* (q+1)=*Q; at -* (q+1)=temp; - } - - } - in - intMainvoid) to { + intA[n]; - intm,i; the *printf"Please enter%d number: \ n", N); $ for(i=0; i<n; i++)Panax Notoginsengscanf"%d",&a[i]); - theprintf"Please enter the number of digits you want to move to the right:"); +scanf"%d",&m); A the Move (A, N, m); + -printf"the order of the array elements after the position is moved:"); $ for(i=0; i<n;i++) $printf"%5d", A[i]); - -System"Pause"); the - return 0;Wuyi}View Code
C language Problem