Hello laserlight..
Yes i want to get input from the user, and i wrote the code as you said that it should be in the main function.
This is what i've done yet.
Code:
#include <iostream.h>
#include <conio.h>
void sum(int a[],const int size);
void main()
{
int ar[];
const int size;
for(int i=0 ;i<size; i++)
{
cin>>ar[i];
}
sum();
getch();
}
void sum(int a[], const int size)
{
int s=0;
for(int i=0;i<size;i++)
{
s=s+a[i];
}
cout<<s;
}
And i'm getting errors in it.
Will you tell what should i do?
Where i'm calling function "sum()" i've a confusion here.