programming9
  • Flowcharts
  • Programs
      • Back
      • C Programs
      • C++ Programs
      • Java Programs
      • Python Codes
      • HTML Codes
      • Java Script Codes
      • SQL Codes
  • Tutorials
      • Back
      • Java Tutorials
      • Competitive Programming
      • Python Tutorials
      • C Programming
  • Blog
  • Login

C Program to Reverse Elements in Array

Details
Written by: RajaSekhar
Category: C Programs
  • Arrays in C
#include<stdio.h>
int main()
{
	int n, i, j, *p, a[10], b[10];
	printf("Enter the number of elements :: ");
	scanf("%d", &n);



	printf("Enter the elements : ");
	for(i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}

	//REVERSING THE ARRAY

	p=a;
	for(i = 0, j = n-1; i < n; i++, j--)
	{
		b[i] = *(p+j);
	}
	printf("The reversed array :: ");

	for(i = 0; i < n; i++)
		printf("%d  ", b[i]);

	printf("\n");
	return 0;
}

 OUTPUT:

Enter the number of elements :: 6
Enter the elements : 10 20 30 40 50 60
The reversed array :: 60  50  40  30  20  10

Previous article: C Program for MERGING of Two Arrays with out using Third Array Prev Next article: C Program to Perform Operations on Doubly Linked List Next
  • C program to find Sum of Digits of a Positive Integer Number
  • C Program to Simulate PRIORITY CPU Scheduling Algorithm
  • Simulate Bankers Algorithm for Deadlock Avoidance Using C
  • C Program to convert Celsius to Fahrenheit
  • C Program to Find Roots of a Quadratic Equation
  • C Program to Implement Structure with Array
  • Evaluate Algebraic Expression (ax+b)/(ax-b)
  • C Program to Search an Array Element using BINARY SEARCH
  • C program to Convert Number to Words
  • C Program to find Reverse of a Number
  • C Program to Find Length of a String Using STRLEN()
  • C Program for Insertion Sort
  • Implementation of Queue using Array in C
  • C Program to Find String Length with out using Function
  • C Program to Print Addresses of Variables
  • Privacy Policy
  • Cookie Policy
© programming9.com 2026
Back to top