fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct Node{
  5. int data;
  6. struct Node *next;
  7. } Node;
  8.  
  9. void cr_list(Node *head){
  10. Node *tmp;
  11. int in;
  12.  
  13. scanf("%d", &in);
  14. while(in != EOF){
  15. if(head == NULL){
  16. head = (Node *)malloc(sizeof(Node));
  17. head->data = in;
  18. head->next = NULL;
  19. }else{
  20. tmp = (Node *)malloc(sizeof(Node));
  21. head->data = in;
  22. head->next = tmp;
  23. }
  24. scanf("%d", &in);
  25. }
  26. }
  27.  
  28. void print(Node *head){
  29. Node *p;
  30. p = head;
  31. while(p){
  32. printf("out: %d\n", p->data);
  33. p = p->next;
  34. }
  35. }
  36.  
  37. int main(){
  38. int pause;
  39. Node *head = NULL;
  40. cr_list(head);
  41. print(head);
  42. scanf("%d", &pause);
  43. }
Time limit exceeded #stdin #stdout 5s 162304KB
stdin
1 2 3
stdout
Standard output is empty