Here’s a link back to the GitHub project page.

Introduction

A set of general-purpose dynamic array macros for C structures are included with uthash in utarray.h. To use these macros in your own C program, just copy utarray.h into your source directory and use it in your programs.

#include "utarray.h"

The dynamic array supports basic operations such as push, pop, and erase on the array elements. These array elements can be any simple datatype or structure. The array operations are based loosely on the C++ STL vector methods.

Internally the dynamic array contains a contiguous memory region into which the elements are copied. This buffer is grown as needed using realloc to accommodate all the data that is pushed into it.

Download

To download the utarray.h header file, follow the links on https://github.com/troydhanson/uthash to clone uthash or get a zip file, then look in the src/ sub-directory.

BSD licensed

This software is made available under the revised BSD license. It is free and open source.

Platforms

The utarray macros have been tested on:

  • Linux,

  • Mac OS X,

  • Windows, using Visual