I'm working on returning a char from a function. Everything works fine when I get these weird symbols on the screen.
#include <iostream>
void testfunc(char* outStr);
int main()
{
char FirstName[10];
testfunc(FirstName);
std::cout << "So far so good.";
std::cout << std::endl;
std::cout << FirstName;
std::cout << std::endl;
std::cout << "It worked!";
std::cout << std::endl;
system("pause");
return 0;
}
void testfunc(char* outStr)
{
char FirstName[10];
std::cin >> FirstName;
outStr = FirstName;
}
I have a picture of the problem but it seems I can't post any. the output looks like random bloks followed by numbers and symbols. It's not an address. It does compile and run through the program fine. the cout's before and after FirstName, all output just fine. FirstName itself, however, outputs symbols and blocks.