I receive this error:
array.cpp: In function ‘void strcat2(char*, const char*)’: array.cpp:74: error: invalid conversion from ‘char’ to ‘char*’ array.cpp:74: error: initializing argument 1 of ‘void strcpy2(char*, const char*)’ array.cpp:74: error: invalid conversion from ‘char’ to ‘const char*’ array.cpp:74: error: initializing argument 2 of ‘void strcpy2(char*, const char*)’
When trying to run this code:
//Concatenates two arrays of characters using pointers
void strcat2(char* t, const char* s)
{
unsigned int i;
for (i = 0; *t; i++);
strcpy2(*(t + i), *s);
}
Here is the strcpy2 function it calls:
//Copies the information from one array of characters to another using pointers
void strcpy2(char* t, const char* s)
{
for ( ; *t++ = *s++;);
}
It says invalid conversion from char to char*, but where am I trying to convert from char to char*? It seems to me that everything in the code is char*. What am I missing?
I've looked over this code many times and can't seem to find what is wrong. I'm relatively new to pointers, go easy! Thank you very much for any help!
std::string? - Peter Huenechar*for strings in C++ ;) - Peter Huene