Created
January 6, 2017 18:53
-
-
Save rsmahmud/79f339f8e36572fb248fd5c52925a198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#define MAX 3 | |
int *return_array(int x[], int y[],int count){ | |
int i; | |
int *z = (int*)malloc(count); | |
for(i=0; i<count; i++) | |
z[i] = x[i] * y[i]; | |
return z; | |
} | |
int main(){ | |
int i, *c, a[MAX], b[MAX]; | |
printf("Enter %d Elements for Array 1 : ",MAX); | |
for(i=0; i<MAX; i++) | |
scanf("%d",&a[i]); | |
printf("Enter %d Elements for Array 2 : ",MAX); | |
for(i=0; i<MAX; i++) | |
scanf("%d",&b[i]); | |
printf("\nFirst Array : "); | |
for(i=0; i<MAX; i++) | |
printf("%3d ",a[i]); | |
printf("\nSecond Array : "); | |
for(i=0; i<MAX; i++) | |
printf("%3d ",b[i]); | |
c = return_array(a,b,MAX); | |
printf("\nProduct Array : "); | |
for(i=0; i<MAX; i++) | |
printf("%3d ",c[i]); | |
fflush(stdin); | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment