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

Function reverse

CPP/array-2d/reverse_array.cpp:3–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1 #include<bits/stdc++.h>
2 using namespace std;
3 int reverse(int arr[], int n){
4 int s=0;
5 int e= n-1;
6 while(s<=e){
7 swap(arr[s],arr[e]);
8 s+=1;
9 e-=1;
10 }
11 return 0;
12 }
13 void initial(){
14 #ifndef ONLINE_JUDGE
15 freopen("input.txt", "r", stdin);

Callers 1

mainFunction · 0.70

Calls 1

swapFunction · 0.50

Tested by

no test coverage detected