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
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- C program to copy contents of one file to another file
- Program to print numbers from N to 1 in reverse order
- 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
- C program to sort an array in ascending order
- Write a C program that displays contents of a given file like 'more' utility in Linux
- Reverse Level Order Traversal
- Print Fibonacci Series in reverse order
- Print words of a string in reverse order
- Print Doubly Linked list in Reverse Order
- C program to print odd line contents of a File followed by even line content
- Merge two sorted linked lists such that merged list is in reverse order
- C program to copy string without using strcpy() function
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.