Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions