C examples for String:String Function
Read input and append them together
#include <stdio.h> #include <string.h> int main()//from w w w .java 2s .c om { char city[15]; // 2 chars for the state abbrev. and one for the null zero char st[3]; char fullLocation[18] = ""; puts("What town do you live in? "); gets_s(city); puts("What state do you live in? (2-letter abbreviation)"); gets_s(st); strcat(fullLocation, city); strcat(fullLocation, ", "); strcat(fullLocation, st); puts("\nYou live in "); puts(fullLocation); return(0); }