File: test45.c

package info (click to toggle)
uthash 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,788 kB
  • sloc: ansic: 9,838; makefile: 178; perl: 88; sh: 37; cpp: 30
file content (36 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include "utarray.h"

int main()
{
    UT_array *a;
    int i, *p=NULL;
    utarray_new(a, &ut_int_icd);
    for(i=0; i<10; i++) {
        utarray_push_back(a,&i);
    }
    utarray_pop_back(a);
    utarray_erase(a,0,1);
    while ( (p=(int*)utarray_next(a,p)) != NULL ) {
        printf("%d ",*p);
    }
    printf("\n");
    i = 100;
    utarray_insert(a,&i,3);
    while ( (p=(int*)utarray_next(a,p)) != NULL ) {
        printf("%d ",*p);
    }
    printf("\n");
    utarray_extend_back(a);
    p = (int*)utarray_back(a);
    *p = 1000;
    p = NULL;
    while ( (p=(int*)utarray_next(a,p)) != NULL ) {
        printf("%d ",*p);
    }
    printf("\n");
    utarray_clear(a);
    utarray_free(a);
    return 0;
}