Question
Here's the problem I've been stuck on for a day or two now: Suppose you have a main() with three local arrays, all the same size and type (say float). The first two are already initialized to values. Write a function called addarrays() that accepts the addresses of the three arrays as arguments; adds the contents of the first two arrays together, element by element; and places the results in the third array before returning. A fourth argument to this function can carry the size of the arrays. Use pointer notation throughout; the only place you need brackets is in defining the arrays.
Explanation / Answer
include #include 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