The immediate fix for the problem you have seen is changing the nul termination statement to:
str[p] = '\0';
This change is required as you want to assign a char ('\0') and not a char * ("\0").
However, as the source string is nul terminated, you can copy the terminator with the whole string.
In addition, note that if the source string would be longer than 80 chars, you will have a buffer overflow.