I am new to the C++ programming language. This code is a simple String Copy function i did in Visual Studio, but it's not working the way I expect.
// main file
int _tmain(int argc, _TCHAR* argv[])
{
char source[] = { "Computer" };
int sourcelength = strlen(source);
printf("Source = %s", source);
char* destination = new char[sourcelength];
StringCopyFn(destination, source); // error is on this line
printf("Source = %s", source);
scanf_s("Hello World");
return 0;
}
// String Copy
StringCopyFn::StringCopyFn()
{
}
void StringCopy(char* destination, char* source)
{
int i = 0;
while (source[i] != '\0')
{
destination[i] = source[i];
i++;
}
}
StringCopyFn::~StringCopyFn()
{
}
I'm getting the following error message:
no instance of constructor matches the argument list
How do I correct this error?