Given an array, the task is to copy these array elements into another array in reverse array.
Input: array: 1 2 3 4 5 Output: 5 4 3 2 1 Input: array: 10 20 30 40 50 Output: 50 40 30 20 10
Let len be the length of original array. We copy every element original_arr[i] to copy_arr[n-i-1] to get reverse in copy_arr.
Original array: 1 2 3 4 5 Resultant array: 5 4 3 2 1
- C program to copy contents of one file to another file
- Sort an array where a subarray of a sorted array is in reverse order
- C Program to Reverse Array of Strings
- C Program to print contents of file
- C Program to merge contents of two files into a third file
- Write a C program that displays contents of a given file like 'more' utility in Linux
- Reverse Level Order Traversal
- Print words of a string in reverse order
- Print Fibonacci Series in reverse order
- Print Doubly Linked list in Reverse Order
- Merge two sorted linked lists such that merged list is in reverse order
- C program to copy string without using strcpy() function
- Perl | Reverse an array
- C Program for Reverse a linked list
- Program to Reverse a String using Pointers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.