Home Tutorial Datastructure Array Implementation in C

 
 

Share on Google+Share on Google+
Array Implementation in C
Posted on: April 30, 2010 at 12:00 AM
Advertisement
In this tutorial you will learn how to implement an array in C. There are two function in this given example one for reading the array element and other for writing on console.

Array Implementation in C

Code:

#include<stdio.h>
#include<conio.h>
void main()
 {
  void read(int *,int);
  void display(int *,int);
  int size[5],i,sum=0;

  clrscr();
  printf("Enter five elements for an array \n");
  read(size,5);
  printf("All elements of the array are : \n");
  display(size,5);
}

 void read(int c[],int i)
  {
	int j;
	for(j=0;j<i;j++)
	scanf("%d",&c[j]);
	fflush(stdin);
  }

  void display(int d[],int i)
  {
	int j;
	for(j=0;j<i;j++)
	printf("%d  ",d[j]);
	printf("\n");
  }

Output:

Download this code

Advertisement

Related Tags for Array Implementation in C:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 30, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com