i really doubt that this person has gotten to functions since he is still asking about arrays, we should try and keep it simple in order not to confuse people.
i really doubt that this person has gotten to functions since he is still asking about arrays, we should try and keep it simple in order not to confuse people.
If you bothered to read the code in the OP, you could allay your doubt.
#include <iostream>
#include <stdio.h>
using namespace std;
int getArray(int x[]);
int main ()
{
int a[10];
getArray(a);
return 0;
}
int getArray(int x[])
{
int sum=0;
for (int count = 0; count < 10; count ++)
{
cout << "Input Array "<<count<<":";
cin >> x[count];//assigning the user input to the elements in the array
sum=sum+x[count]; //adding the elements of the array x
}
cout<<"Sum of 10 numbers in an array is ="<<sum<<"\n";
system("pause");
return 0;
}