Reverse Array using Pointers in C++ Last Updated : 23 Jun, 2025 Comments Improve Suggest changes Like Article Like Report Reversing an array is a common problem in programming where the task is to reorder the elements of the array so that the first element becomes the last, the second element becomes the second last, and so on.Example:Input: arr[] = {10, 20, 30, 40, 50}Output: 50 40 30 20 10To reverse an array using pointers, we can use two pointer approach: one pointing to the start of the array and other pointing to the end of the array while swapping the values at these pointers and moving the start pointer forward and the end pointer backward until pointers meet each other.Example Code C++ #include <iostream> using namespace std; void reverseArray(int* arr, int size) { // Pointer to first element int* start = arr; // pointer to last element int* end = arr + size - 1; // Until both pointers meet while (start < end) { // Swap values at start and end int temp = *start; *start = *end; *end = temp; // Move pointers start++; end--; } } int main() { int arr[] = {10, 20, 30, 40, 50}; int size = sizeof(arr) / sizeof(arr[0]); reverseArray(arr, size); for (int i = 0; i < size; i++) cout << *(arr + i) << " "; cout << endl; return 0; } Output50 40 30 20 10 Comment More infoAdvertise with us A abhishekcpp Follow Improve Article Tags : C++ cpp-array cpp-pointer Explore Introduction to C++Introduction to C++ Programming Language2 min readHeader Files in C++5 min readSetting up C++ Development Environment8 min readDifference between C and C++3 min readBasicsC++ Data Types7 min readC++ Variables4 min readOperators in C++9 min readBasic Input / Output in C++5 min readControl flow statements in Programming15+ min readC++ Loops7 min readFunctions in C++8 min readC++ Arrays8 min readStrings in C++5 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++11 min readFile Handling through C++ Classes8 min readMultithreading in C++8 min readNamespace in C++5 min readC++ OOPInheritance in C++10 min readC++ Polymorphism5 min readEncapsulation in C++4 min readAbstraction in C++4 min readStandard Template Library(STL)Containers in C++ STL3 min readIterators in C++ STL10 min readC++ STL Algorithm Library2 min readPractice C++C++ Interview Questions and Answers1 min readTop C++ DSA Related ProblemsC++ Programming Examples7 min read Like