Guest User

Untitled

a guest
Jun 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int c;
  6. while ((c = getchar()) != EOF){
  7. putchar(c);
  8.  
  9. }
  10. }
  11.  
  12. hello world
  13. hello world
  14.  
  15. #include <stdio.h>
  16.  
  17. int main()
  18. {
  19. int c,b;
  20. /* printf(EOF); Segmentation fault (Core dumped) */
  21. while (b = ((c = getchar()) != EOF)){
  22. printf("Bool: %dn", b);
  23. putchar(c);
  24.  
  25. }
  26. }
  27.  
  28. hello world
  29. Bool: 1
  30. h
  31. Bool: 1
  32. e
  33. Bool: 1
  34. l
  35. Bool: 1
  36. l
  37. Bool: 1
  38. o
  39. Bool: 1
  40.  
  41. Bool: 1
  42. w
  43. Bool: 1
  44. o
  45. Bool: 1
  46. r
  47. Bool: 1
  48. l
  49. Bool: 1
  50. d
  51. Bool: 1
Add Comment
Please, Sign In to add comment