#include #include int main() { // strings are null-terminated arrays of characters char school[] = "yale"; // compiler detects size (5 -- 4 chars + null) char given_name[] = {'J', 'a', 'm', 'e', 's', '\0'}; //char given_name[] = "James"; // equivalent to above char family_name[10] = "Glenn"; // extra space uninitialized char depart[] = "cs"; char empty[3] = ""; char full_name[strlen(given_name) + strlen(family_name) + 3]; //strcat(given_name, "what is going to happen here?"); strcpy(full_name, family_name); strcat(full_name, ", "); strcat(full_name, given_name); char copy[strlen(full_name) + 1]; strcpy(copy, full_name); printf("%d\n", strlen(full_name)); printf("%s\n", copy); // DONT DO THIS VERY DANGEROUS!!! //scanf("%s", given_name); } void read_line(char *s, int max) { int count = 0; int ch; while ((ch = getchar()) != EOF && ch != '\n') { if (count < max) { s[count] = ch; } count++; } if (count > max) { s[max] = '\0'; } else { s[count] = '\0'; } }