I am pretty new to C programming, and trying to run a simple program, which put string t at the end of string s:
#include <stdio.h>
void _strcat(char *s, char *t){
for(;*s;s++);
for(;(*s=*t)!='\0';s++,t++);
}
int main()
{
char *s="hello";
char *t="how are you?";
_strcat(s,t);
getchar();
return 0;
}
But I constantly get an annoying error for assigning two pointers (of the same type) *s=*t;
this is the error:
Thread 1: EXC_BAD_ACCESS (Code 2, Address=.....)