beginner here:
This probably look rudementary but I have having a hard time understanding strings. What I want to do is copy a single character back to the character before it. So if I have the string abc
after my code executes it would be bc
except what my goal is, is to eliminate spaces. Eg \n\n\nCPP
becomes CPP
I have to accomplish this using C strings. So here is my code that is not working
1 2 3 4 5 6 7 8
for (p=0; p<i; p++)
{
do
{
strcpy(line[t][p], line[t+1][p]);
}while(line[t][p]=='\n');
t++;
}
errors invalid conversion from `char' to `char*'
and initializing argument 1 of `char* strcpy(char*, constchar*)'
I get both those errors twice
I am not sure how to accomplish this task using C strings so any help would be greatly appreciated.
Yes it is I guess I forgot to include the declaration being char line[500][100];
so I need to use a pointer to use the strcpy function? I have never used pointers before so I'm not to sure