Hello guys! I am almost done with my assigment, but I came with a problem that seems really dificult to me.
1 2 3 4 5 6 7 8
void Total&Average(string filename)
{
ifstream inFile;
inFile.open(filename, ios::in);
int myarray[30];
int total = 0, count = 0;
double average = 0.0;
while (inFile >> myarray[count] && count < 30)
In this part of my work, I created an array in a void function; I need to use this same array into another void function, but I don't know how to call this array.
That array is local to that function. It will go out of scope when that function returns.
If you can call that other function from within Total&Average, then do so and pass the array to that function. If not, then you'll need to create the array within main so that it can be used in other functions as well.