#include #include #include int main() { /* define 3 immutable strings */ char word[]= "hello there"; char stuff[10] = "compute"; char number[10]; char line[10]; printf("Addresses of each string\n"); printf("word address = %u\n", &word); printf("stuff address = %u\n", &stuff); printf("number address = %u\n", &number); printf("line address = %u\n", &line); printf("\n"); printf("output a string \n"); printf("word is %s\n", word); printf("\n"); printf("prompt and input a string \n"); printf("Enter a word "); scanf("%s", line); printf("\n"); printf("demonstrate strlen \n"); printf("%s has %i letters\n", line, strlen(line)); printf("\n"); printf("concatenate word onto end of line (enough space?)\n"); strcat(line, word); printf("line after concatenation is %s\n", line); printf("word is unaffected: %s\n", word); printf("\n"); printf("concatenate word onto end of stuff (not enough room!) \n"); strcat(stuff, word); printf("word = %s\n", word); printf("stuff = %s\n", stuff); printf("line = %s\n", line); printf("\n"); printf("copy line into stuff\n "); printf("Before copy, stuff contains %s\n", stuff); strcpy(stuff, line); printf("after copy, stuff contains %s\n", stuff); printf("\n"); printf("demonstrate atoi\n"); printf("enter an integer: "); scanf("%s", number); printf("you entered %i\n", atoi(number)); return 0; }