Skip to content

Instantly share code, notes, and snippets.

@abranhe
Created September 28, 2018 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abranhe/7b0fa8893a36edc01d3b11ebaecc4a8c to your computer and use it in GitHub Desktop.
Save abranhe/7b0fa8893a36edc01d3b11ebaecc4a8c to your computer and use it in GitHub Desktop.
Reverse items in array
//
// Reverse an array
// Carlos Abraham (abranhe.com)
// https://stackoverflow.com/questions/19712903/reverse-contents-in-array
//
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int arr [10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
reverse(begin(arr), end(arr));
for(auto item:arr)
{
cout << item << " ";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment