by Dinesh Thakur Category: Array

The procedure of passing more than one arrays to a function is similar to the case of passing a single array. This is illustrated in Program.

#include <stdio.h>

void Product(int[], int[], int[], size_t);
//Function Prototype with three arrays as parameters
int main()
{
   int i, j;
   int Dal[5]; // declarations of arrays.
   int Din [5];
   int San [5];
   clrscr();
   printf("Enter 5 decimal numbers for Dal: ");
   for( i=0;i<5;i++)
      scanf ("%d", &Dal [i]);
      printf("Enter 5 numbers for Din: ");
      for( j=0;j<5;j++)
     scanf("%d", &Din[j]); // Entering array elements
     Product( Dal, Din, San, 5);
     return 0;
}
void Product(int Dal[], int Din[], int San[], size_t s1 )
{
  int m;
  for ( m =0; m<s1; m++)
   {
     San[m]= Dal[m] * Din[m];
     printf("%d\t", San[m]);
   }
}

C Program passing of more than one arrays to a function



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles