Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctime.h>
  3. #define SIZE (1000*1000)
  4.  
  5.  
  6. struct item
  7. {
  8. int key;
  9. void *data;
  10. item *next;
  11. };
  12.  
  13.  
  14. item *head;
  15.  
  16.  
  17. void main()
  18. {
  19. int i;
  20. item *p;
  21. time_t ts0,ts1;
  22. head=new item;
  23. p=head;
  24. for(i=0;i<SIZE-1;i++)
  25. {
  26. p->next=new item;
  27. if (p->next==NULL) printf("\nerror");
  28. p=p->next;
  29. }
  30. printf("\npoint0");
  31. ts0=time(NULL);
  32. for(i=0;i<600;i++)
  33. for(p=head;p!=NULL;p=p->next)
  34. p->key=0;
  35. printf("\npoint1");
  36. ts1=time(NULL);
  37. printf("\ntime elapsed %d (s)\n",(int)(ts1-ts0));
  38. scanf("%d",&i);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement