Passing ~ pass whole array in function in c language.
■ passing whole array in function
■》Input->
#include<stdio.h>
#include<conio.h>
void display(int a[],int s);
void main()
{
int arr[5]={1,2,3,4,5};
display(arr,5);
getch();
}
void display(int a[],int s)
{
for(int i=0; i<s; i++)
{
printf("%d ",a[i]);
}
}
■》output->
1 2 3 4 5
Comments
Post a Comment