There's a few things you don't understand here.
Strings are mutable in C, and while strcat() does return a pointer to the "new" string, it also adds a to b:
Code:
char a[256] = "hello ",
b[] = "world";
strcat(a, b);
puts(a);
'a' is now "hello world". Notice that I was careful to make sure there is enough space in a to include the addition.
There is a subtle difference between a regular char array and a string literal:
Code:
char *pointerToLiteral = "string literal";
char arrayString[] = "string in array";
The first one is declared as a pointer, but what it points to is a string literal. String literals are not mutable. The pointer itself can be reassigned, but you cannot change the literal it currently points to.
Ie, you cannot use either of these:
Code:
char *str1 = "Hello";
char *str2 = " World!";
As the first argument to strcat().
WRT to malloc(), it assigns an address with whatever amount of memory attached. When you do this:
Code:
conca = (char *) malloc (100);
conca = newstring;
You throw that memory away (ie, leak it) by reassigning the pointer to some other address (the return value from the previous strcat). That memory is still allocated, but you can never do anything with it again because you have no way to access it (hence, leaked).