How do I combine multiple strings. For example,
char item[32]; scanf(\"%s\", item); printf(\"Shopping list: %s\\n\", item); //I want to combine this string
use strcpy and strcat
strcpy
strcat
char item[] = "Shopping list"; char hw[] = "To do list: Sleep \n"; char* itemhw; itemhw = malloc(strlen(item)+strlen(hw)+1); strcpy(itemhw, item); strcat(itemhw, hw); free(itemhw);