If you need a copy of the pointer, you can use:
tempmonth = month;
but this means that both point to the same underlying data - change one and this will affect both.
If you need independent strings, you will have a good chance that your system will be strdup , in which case you can use:
tempmonth = strdup (month); // Check that tempmonth != NULL.
If your implementation does not have strdup , get one :
char *strdup (const char *s) { char *d = malloc (strlen (s) + 1);
To print lines in a formatted format, look at the printf family, although for a simple line such as this will be standard output, puts can be quite good (and probably more efficient).
source share