"Carmen Sei" <fa**********@yahoo.comwrote in message why the following
code not compile
>
================
#include <iostream>
using std::cout; // must need for using cout
using std::endl;
#include <string>
using std::string;
int main()
{
string stringa("abc");
string stringb("bbb");
cout << merge (stringa, stringb);
} // end main
string merge ( string a, string b){
string c = a + b;
return c;
}
Compiler needs to know the signature/prototype of the functions that it
comes across while compiling. We generally include header files for this
purpose, like <stdio.hfor printf. In your case compiler doesn't know about
the merge function, when it encounters it in main. So add the function
prototype of merge before main, or move the definition before main.
Sharad