C Program to accept values into an array and print array in reverse and original format by using three different functions

CWC
0 Min Read
#include<stdio.h>
#include<conio.h>
void read_array(int x[]);
void print_array(int y[]);
void rev_array(int z[]);
main()
{
int a[5];
clrscr();
read_array(a);
printf_array(a);
rev_array(a);
getch( );
}
void read_array(int x[])
{
int i;
for(i=0;i<=4;i++)
{
printf(“enter values for a[%d]:”,i);
scanf(“%d”,&x[i]);
}}
void print_array(int y[])
{
int i;
for(i=0;i<=4;i++)
printf(“%d”,y[i]);
}
void rev_array(int z[])
{
int i;
for(i=4;i>=0;i--)
printf(“\n%d”,z[i]);
}

 

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version