Question: Write a move function, in C language, to move the (n-m) elements in a n-element array towards the end in sequence. Consider the following. Please

Write a move function, in C language, to move the (n-m) elements in a n-element array towards the end in sequence. Consider the following. Please leave comments to explain your code and verify that it runs properly.

Example:

How many numbers? 8

Input 8 numbers:

1 2 3 4 5 6 7 8

How many place you want to move? 4

Now, they are:

5 6 7 8 1 2 3 4

#include move(int array[20], int n, int m){ //write your code here } void main(){ int number[20], n, m, i; printf("How many number?"); scanf("%d", &n); printf("Input %d numbers: ", n); for (i = 0; i < n; i++){ scanf("%d", &number[i]); } i = 0; printf("How many place you want to move?"); scanf("%d", &m); move(number, n, m); printf("Now, they are: "); for (i = 0; i < n; i++){ printf("%d ", number[i]); } getchar(); getchar(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!