No matter what I do, I keep getting the same error:
finalarrays.cpp:(.text+0x18a): undefined reference to `stats(int*, int)'
collect2: error: ld returned 1 exit status
I've managed to get rid of the error, but now the sum and average values are all messed up
1 2 3 4 5 6 7 8 9 10
[mbedoya@storm cisc1600r042018]$ ./a.out
How many elements (maximum = 100): 6
Enter number 1: 69
Enter number 2: 420
Enter number 3: 8675
Enter number 4: 30
Enter number 5: 9
Enter number 6: 42
69 420 8675 30 9 42
Position Value
1 69
2 420
3 8675
4 30
5 9
6 42
Sum = 41791
Average = 6965.17
I have a final in 12 hours and if i don't start understanding arrays i'm gonna fail. Please help
On line 48 the sum variable is uninitialized. A golden rule always initialize your variables, preferably when you have a sensible value to assign to them. Here though you need to set to 0 first.
There is no point in the function returning 0 every time, make it void seen as it does the output.