Friday 20, April 2018
Welcome Guest, Register | Login  
      Home       Tutorials       Free Ebooks       Free Scripts       Tech News       Articles       About Us       Blog        Forum

  C Program to Reverse an array

Here is a program which will take input from user in array and will reverse it using c language.
Cut & Paste Script

#include<stdio.h>
#include<conio.h>
void read(int *,int);
void dis(int *,int);
void inverse(int *,int);

main(){

   int a[5],i;

   read(a,5);
   dis(a,5);
   inverse(a,5);
   dis(a,5);
   getch();
}

void read(int c[],int i)
{
   int j;
   printf("Enter the list \n");
   for(j=0;j<i;j++)
      scanf("%d",&c[j]);
   fflush(stdin);
}
void dis(int d[],int i)
{
   int j;
   printf("The list is \n");
   for(j=0;j<i;j++)
      printf("%d ",d[j]);
   printf("\n");
}
void inverse(int inver_a[],int j)
{
   int i,temp;
   j--;
   for(i=0;i<(j/2);i++)
   {
      temp=inver_a[i];
      inver_a[i]=inver_a[j];
      inver_a[j]=temp;
      j--;
   }
}
   
     RELATED SCRIPTS
 
C program to join two strings without using strcat
This c language program will join two strings without using strcat string function....more »
Category : C Programs Hits : 2258
   
pointer and there uses in c
Example code for pointer and there uses in c language....more »
Category : C Programs Hits : 1972
   
Bubble sort using c language
This program will sort an array using bubble sort in c language. c program for bubble sort, bubble sort in c, sorting an array using bubble sort in c language....more »
Category : C Programs Hits : 3766
   
Find a substring in another string using c
This program will input a string and a substring and than check whether the substring is present is string or not....more »
Category : C Programs Hits : 3812
   
arrays and pointers in c
An example code for arrays and pointers in c language....more »
Category : C Programs Hits : 1996
   
   
SCRIPT CATEGORIES
 
  C Programs
C Programs scripts
  C++ Programs
C++ Programs scripts
  Java Programs
Java Programs scripts
  JavaScript Examples
JavaScript Examples scripts
  PHP Examples
PHP Examples scripts
  VBScript Examples
VBScript Examples scripts
 
 
 
POPULAR E-BOOKS
 
Download Biz Opp Of The Decade Ebook Biz Opp Of The Decade
   
Download Cashing in with Resell Rights Ebook Cashing in with Resell Rights
   
Download Six steps to Follow to garantee the Success Ebook Six steps to Follow to garantee the Success
   
Download PPC  Pay Per Click Google AdWords Made Easy  Ebook PPC Pay Per Click Google AdWords Made Easy
   
Download Make Money with Adsense 2008 Ebook Make Money with Adsense 2008
   
Studiesinn.com 2018 All Rights Reserved.