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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- C program to copy contents of one file to another 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
- C Program to print contents of file
- C program to print odd line contents of a File followed by even line content
- Check whether an array can be fit into another array rearranging the elements in the array
- Sort an array where a subarray of a sorted array is in reverse order
- Program to print numbers from N to 1 in reverse order
- C program to append content of one text file to another
- Count elements that are divisible by at-least one element in another array
- Convert one array to another using adjacent swaps of elements
- Merge two sorted linked lists such that merged list is in reverse order
- Print words of a string in reverse order
- Print Fibonacci Series in reverse order
- Print Doubly Linked list in Reverse Order
- Reverse Level Order Traversal
- Check if a given number is one less than twice its reverse
- C program to copy string without using strcpy() function
- C program to create copy of a singly Linked List using Recursion
- Sort first k values in ascending order and remaining n-k values in descending order
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.