Hi
I´m doing homework and it ask for the strcpy function by using pointers.
This is my code but I always get some runtime error, don´t know why.
#include <iostream>
using namespace std;
void strcpy2(const char* source, char* destination);
int main()
{
char* source = "Hello world";
char* destination;
strcpy2(source, destination);
system("pause");
return 0;
}
void strcpy2(const char* source, char* dest)
{
while (*source != 0)
{
*dest = *source;
dest++;
source++;
}
*dest = 0;
}