fork download
  1. #include <stdio.h>
  2.  
  3. #define SIZE 32
  4.  
  5. int main(void) {
  6. char string[3][SIZE];
  7. int i, j;
  8. int c;
  9.  
  10. printf("Enter three lines of text:\n");
  11.  
  12. for (i = 0; i < 3; i++) {
  13. j = 0;
  14. while (j < SIZE-1 && (c = getchar()) != '\n') {
  15. string[i][j++] = c;
  16. }
  17. string[i][j] = 0;
  18. }
  19.  
  20. for (i = 0; i < 3; i++) {
  21. for (j = 0; j < SIZE && string[i][j]; j++) {
  22. printf("%c", string[i][j]);
  23. }
  24. printf("\n");
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 10320KB
stdin
Hi my name is John.
I am from the US
and I'm a student.
stdout
Enter three lines of text:
Hi my name is John.
I am from the US
and I'm a student.