Hello, I am attempting to write a program in which I write my own version of the library function 'strcat' using pointers:
Code:
#include "stdio.h"
#include "string.h"
void mystrcat(char *first, char *second);
int main(void)
{
mystrcat("hello","world");
getch();
return 0;
}
void mystrcat(char *first, char *second)
{
char result[strlen(first)+strlen(second)];
while(*first) *result++ = *first++;
while(*second) *result++ = *second++;
*result = '\0';
printf(result);
}
When I try to compile it, I get two errors saying "wrong type argument to increment". What is the problem?