i made a mystrcpy function,
void mystrcpy(char *&stuff, const char *&otherstuff){
for(int i=0; stuff[i]&&other[i]; i++){
stuff[i]=other[i];
}
}
and a main function:
int main(){
char *hello="hello";
mystrcpy(hello, "bye bye"/*<--i have no clue what data type this really is!!*/);
printf("%s\n", hello);
return 0;
}
it does not compile, and says "invalid initialization of non-const reference of type 'const char*&' from an rvalue of type 'const char *'"...
when i just do:
const char *bye="bye bye";
mystrcpy(hello, bye);
it compiles without error.
i need to know why the former one doesnt work, thanks.