Hi, little problem with references, char*s and passing.
To simplify the problem:
This doesn't compile. I could pass foo(*c,*d), but then foo() will only have access to the first character.Code:#include <iostream.h>
char& foo(char& c, const char& d) {
cout << c << " " << d << endl;
c = d;
return c;
}
main() {
char* c = "This is a test";
char* d = "This is also a test"
foo(c,d);
cout << c;
}
Insight?