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.

33 lines
577B

  1. #include <stdio.h>
  2. #include "utarray.h"
  3. typedef struct {
  4. int a;
  5. int b;
  6. } intpair_t;
  7. int main()
  8. {
  9. UT_array *pairs;
  10. intpair_t ip, *p;
  11. UT_icd intpair_icd = {sizeof(intpair_t), NULL, NULL, NULL};
  12. utarray_new(pairs,&intpair_icd);
  13. ip.a=1;
  14. ip.b=2;
  15. utarray_push_back(pairs, &ip);
  16. ip.a=10;
  17. ip.b=20;
  18. utarray_push_back(pairs, &ip);
  19. for(p=(intpair_t*)utarray_front(pairs);
  20. p!=NULL;
  21. p=(intpair_t*)utarray_next(pairs,p)) {
  22. printf("%d %d\n", p->a, p->b);
  23. }
  24. utarray_free(pairs);
  25. return 0;
  26. }