I'm new to C++ and running into a lot of sytax all the time.. I havn't been able to find a concrete answer to this in a while now. I'm trying to run this piece of code:
void test(char &testChar){
char B[3] = {"BB"};
testChar = B;
}
int main(int argc, const char * argv[])
{
char A[3] = {"AB"};
test(A);
std::cout << A;
return 0;
}
I want to pass my Variable A
to function test
and have that function replace the content of A
with the content of local variable B
, and then print that out. How should this be done?