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.

31 lines
538B

  1. #include <stdio.h>
  2. #include "utarray.h"
  3. int main()
  4. {
  5. UT_array *nums;
  6. int i, *p;
  7. utarray_new(nums,&ut_int_icd);
  8. for(i=0; i < 10; i++) {
  9. utarray_push_back(nums,&i);
  10. }
  11. for(p=(int*)utarray_back(nums);
  12. p!=NULL;
  13. p=(int*)utarray_prev(nums,p)) {
  14. printf("%d\n",*p);
  15. }
  16. /* the other form of iteration starting from NULL (back) */
  17. p=NULL;
  18. while ( (p=(int*)utarray_prev(nums,p)) != NULL ) {
  19. printf("%d\n",*p);
  20. }
  21. utarray_free(nums);
  22. return 0;
  23. }