TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Reverse Array In C
Shobana J
Jul 29, 2016
22.1
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog, you will learn how to reverse an array in C programming.
reverse.zip
Introduction
In this blog, i am going to explain how to reverse an array.
Software Requirements
Turbo C++ or C.
Programming
#include < stdio.h >
int
main()
{
int
n, c, d, a[100], b[100];
printf(
"Enter the number of elements in array\n"
);
scanf(
"%d"
, & n);
printf(
"Enter the array elements\n"
);
for
(c = 0; c < n; c++) scanf(
"%d"
, & a[c]);
for
(c = n - 1, d = 0; c >= 0; c--, d++) b[d] = a[c];
for
(c = 0; c < n; c++) a[c] = b[c];
printf(
"Reverse array is\n"
);
for
(c = 0; c < n; c++) printf(
"%d\n"
, a[c]);
return
0;
}
Explanation
In the programming given above, it is easily understood that the array is reversed and the output can be printed.
Output
Reverse Array
C
Next Recommended Reading
How To Reverse A Number in C