arraylist_usage.c 448 B

123456789101112131415161718
  1. #include "arraylist.h"
  2. int main(int argc, char** argv) {
  3. List *a = initializeWithCapacity(3);
  4. printf("\t Init len = %d capacity = %d \n", len(a), cap(a));
  5. append(a, 5);
  6. append(a, 4);
  7. append(a, 15);
  8. append(a, 9);
  9. append(a, 19);
  10. printf("\t New len = %d capacity = %d \n", len(a), cap(a));
  11. printf("\t a[3] = %d \n", get(a, 3));
  12. set(a, 3, 8);
  13. printf("\t a[3] = %d after changed \n", get(a, 3));
  14. }