Created
September 28, 2018 03:05
-
-
Save abranhe/7b0fa8893a36edc01d3b11ebaecc4a8c to your computer and use it in GitHub Desktop.
Reverse items in array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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