MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / Reverse

Function Reverse

Arrays/12_Rotate_and_Shift.cpp:24–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void Reverse(struct Array* arr) // function for reversing the array
25{
26 int* B; // making a pointer typr array
27 int i, j;
28 B = new int[arr->size]; // creating the required size of array in heap
29 for (i = arr->length - 1, j = 0; i >= 0; i--, j++) // keeping all the elements from array a to b in reverse order
30 B[j] = arr->A[i]; // coping element everytime
31 for (i = 0; i < arr->length; i++)
32 arr->A[i] = B[i]; // copying back elements to A
33}
34
35void Reverse1(struct Array* arr)
36{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected