fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <stdint.h>
  7. #include <string.h>
  8.  
  9. struct list_element{
  10. uint64_t value;
  11. struct list_element *next;
  12. };
  13.  
  14. struct list_element *list_init(size_t len){
  15. struct list_element *head = (struct list_element *)0;
  16. struct list_element **precedent = &head;
  17. uint32_t i;
  18. srand(time(NULL));
  19. for(i = 0; i < len; i++){
  20. *precedent = malloc(sizeof(struct list_element));
  21. (*precedent)->value = 0xac;
  22. precedent = &(*precedent)->next;
  23. //((uint8_t *) array)[i] = rand();
  24. }
  25. (*precedent)->next = (struct list_element *)0;
  26. return head;
  27. }
  28.  
  29.  
  30. int main(void) {
  31. struct list_element *list;
  32. struct list_element *loop;
  33. list = list_init(10);
  34. }
  35.  
Runtime error #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
Standard output is empty