This is my code and I have the problem [Linker error] undefined reference to `Suma(int, int)'
#include<iostream>
#include<conio.h>
using namespace std;
int Suma(int,int);
int main()
{
int n,x[1],i;
cout<<"Numero de elementos del arreglo?: ";
cin>>n;
for(i==0;i<n;i++)
{
cout<<"elemento "<<i+1<<": ";
cin>>x[i];
}
cout<<"La suma de los elementos es: "<<Suma(n,x[1])<<endl;
cout<<"<<El programa ah finalizado: codigo de salida: 0>>\n";
cout<<"<<Presione enter para cerrar la ventana...>>";
getch();
}
int Suma(int n, int x[])
{
if(n==1) return x[1];
return x[n-1]+Suma(n-1,x);
}
if I change this part Suma(n,x[1])
for Suma(n,x)
the new error is "invalid conversion from int*' to int' " I don't know what's the problem and the result should be:
enter image description here