Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
744B

  1. #include "uthash.h"
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. struct test_t {
  5. int a;
  6. UT_hash_handle hh;
  7. };
  8. int main()
  9. {
  10. struct test_t *tests=NULL, *test;
  11. int a, b;
  12. for (b=0; b < 3; b++) {
  13. for (a=0; a < 10; a++) {
  14. test = NULL;
  15. HASH_FIND(hh, tests, &a, sizeof(a), test);
  16. if (test == NULL) {
  17. test = (struct test_t*)malloc(sizeof(struct test_t));
  18. if (test == NULL) {
  19. exit(-1);
  20. }
  21. memset(test, 0, sizeof(struct test_t));
  22. test->a = a;
  23. HASH_ADD(hh, tests, a, sizeof(a), test);
  24. }
  25. }
  26. }
  27. printf("hash count %u\n", HASH_COUNT(tests));
  28. return 0;
  29. }