Pass Array in Function Program in C

Advertisements

Prev Tutorial Next Tutorial

Pass an Array in Function Program in C

In below program we pass array in function as an arguments and finally print all elements of an array.

C Program to Pass an Array in Function

#include<stdio.h>
#include<conio.h>

void pass(int[],int);
void main()
{
int a[]={1,2,3,4,5};
clrscr();
pass(a,5);
getch();
}
void pass(int b[],int n)
{
int i;
for(i=0;i<n;i++)
{
printf("  %d\n",b[i]);
}
}

Output

1
2
3
4
5

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements