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.

30 lines
576B

  1. #include <stdio.h>
  2. #include "utarray.h"
  3. int main()
  4. {
  5. UT_array *a;
  6. int i, *p;
  7. utarray_new(a, &ut_int_icd);
  8. for(i=0; i<10; i++) {
  9. utarray_push_back(a,&i);
  10. }
  11. for(p=(int*)utarray_front(a); p!=NULL; p=(int*)utarray_next(a,p)) {
  12. printf("%d ",*p);
  13. }
  14. printf("\n");
  15. printf("len: %u\n\n", utarray_len(a));
  16. i=10;
  17. utarray_insert(a, &i, 10);
  18. while ( (p=(int*)utarray_next(a,p)) != NULL ) {
  19. printf("%d ", *p);
  20. }
  21. printf("\n");
  22. printf("len: %u\n\n", utarray_len(a));
  23. utarray_free(a);
  24. return 0;
  25. }