I'm trying to concatenate two strings stored in character pointers, but am doing something wrong. Could someone point out what it is, please? Also, I'm not using any built in functions purposely.
int main()
{
char *a = "abc";
char *b = "def";
char *c;
while(*a != '\0')
{
*c = *a;
a++;
c++;
}
while(*b != '\0')
{
*c = *b;
b++;
c++;
}
*c = '\0';
c -= 6;
while(*c!= '\0')
{
printf("%c", *c);
c++;
}
return 0;
}