You should not be using gets. fgets is a viable alternative, though you should keep in mind that it saves the newline read if there is space.
As for the concatenation: you're accessing the strings as arrays using array index notation, even though you're doing this via pointers. That's fine, but it makes the pointers completely pointless in this context: you might as well use the arrays themselves. Of course, if you wrote a function instead, e.g.,
Code:
void concatenate_strings(char *p_str1, char *p_str2, char *p_str3)
{
/* ... */
}
Then this would happen by default, but really, it isn't really much different in syntax from using the arrays directly. I suspect that if you want to meet the spirit of the restriction, you should use pointers to
traverse the arrays, i.e., you set a pointer to point to the start of an array, then you increment the pointer instead of incrementing an index, and then instead of using array index notation, you dereference the pointer.
EDIT:
Just as gets is problematic because it does not allow you to call it such that buffer overflow can be avoided, your code also needs to be fixed to account for the possibility of buffer overflow, especially since str3 is the same size as the source arrays.