Ask a question from expert

Ask now

A Prototype for Mirroring an Array of Integer Values

1 Pages188 Words390 Views
   

Added on  2019-09-16

About This Document

I ask you to follow this approach and implement a function, which is doing the mirroring part with the following prototype: void mirror(int* array, int from_index, int to_index); where the two indices define the part of the array which is supposed to be mirrored, in C notation (i.e.

A Prototype for Mirroring an Array of Integer Values

   Added on 2019-09-16

BookmarkShareRelated Documents
ProblemImagine that you have an array of integer values. Your goal is to swap the two halves ofthe array.Theapproach is tofirst "mirror" the two halves separately and then mirror thewhole array. Mirror means to reverse the elements in an array or partial array, so {1 2 3 4 5 6} would yield 2 half arrarys {3 2 1} and {654} you then mirror {3 2 1 6 5 4} to get {4 5 6 1 2 3}.I ask you to follow this approach and implement a function, which is doing themirroring part with the following prototype:void mirror(int* array, int from_index, int to_index);where the two indices define the part of the array which is supposed to be mirrored, in Cnotation (i.e. the first element of the array is at index zero).Need to write comments on every line explaining. The code should be done in C language
A Prototype for Mirroring an Array of Integer Values_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
You will be creating a simple version of Game of Life.. Write a
|1
|340
|181

new features of this C++ programming
|12
|1032
|16

CMSC 203 Spring 2016 - Lab 5.
|3
|284
|605

Algorithms for Searching, Sorting, and Matrix Operations
|8
|1756
|131

Squential Search and Sorting Algorithms in C++
|2
|251
|292

IMPORTANT • • • • •.
|19
|2951
|290