Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Reverse Array In C
WhatsApp
Shobana J
8y
22.7
k
0
2
25
Blog
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
C
Reverse Array
Up Next
How To Reverse A Number in C
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found