fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char buffer[50], wc[10], temp[4][10];
  6. int i;
  7.  
  8. //while(fgets(buffer, 50, stdin) != NULL)
  9. strcpy(buffer, "LOOP ADD AREG,A"); //insted of fgets
  10. {
  11. i = 0;
  12. while((sscanf(buffer, "%9s", wc) == 1) && (i < 4)){
  13. //temp[i++] = wc;//incorrect
  14. strcpy(temp[i++], wc);
  15. //check print
  16. puts(wc);
  17. }
  18. }
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
LOOP
LOOP
LOOP
LOOP