luc069.c (788B)
1 /* If the string "Alice in wonder land" is fed to the following scanf() statement, what will be the contents of arrays str1, str2, str3 and str4? 2 */ 3 4 /* Let Us C, Chap- 15 (Strings), Qn No.: C(a) */ 5 6 /* This file is auto-generated by a bot. */ 7 /* This code is not compiled; it is for reference only. */ 8 9 10 #include <stdio.h> 11 #include <string.h> 12 #include <stdlib.h> 13 14 int main() 15 { 16 char str1[20], str2[20], str3[20], str4[20]; 17 18 printf("Enter the string 'Alice in wonder land': "); 19 /* scanf stops reading at the first whitespace character for %s */ 20 scanf("%s%s%s%s", str1, str2, str3, str4); 21 22 printf("\nContents of arrays:\n"); 23 printf("str1: %s\n", str1); 24 printf("str2: %s\n", str2); 25 printf("str3: %s\n", str3); 26 printf("str4: %s\n", str4); 27 28 return 0; 29 }