The question is to - Suppose you have a main() with three local arrays, all the same size but type (say float). The first two are already initialized to values. Write a function called addarrays() that accepts the address of three arrays as arguments add them and put their sum in the third array. The fourth argument in the function can be the size of the array. and use pointer notation through out.
include<iostream>
#include<conio.h>
using namespace std;
int num1, num2, num3; // i declares by array name and type
int*ptr1,*ptr2,*ptr3; // i delacred the type of the pointers
void addingarray (int a, int b, int c, int size) // this is my function
{
*ptr1=a; // i tried to assign the contents of the arrays to the variables
*ptr2=b;
*ptr3=c;
size=sizeof(num1); // here i tried to sum the arrays
for(int j=0;j<size;j++)
for(int i=0;i<size;i++)
c[i][j]=a[i][j] + b[i][j]; // and assign the sum to third empty array
cout<<c;
}
int main ()
{
num1 [5] ={1,2,3,4,5}; // i initialized my array
num2 [5] ={2,5,4,6,4};
num3 [5];
*ptr1=num1; // i equated the content of the array to the pointer
*ptr2=num2;
*ptr3=num3;
cout<< "the result is" << addingarray;
getch();
}