/arr

Arr - Generic arrays in C with length.

Primary LanguageC

 Arr - Generic arrays in C with length.
 BSD license.
 by Sven Nilsen, 2012
 http://www.cutoutpro.com
 
 Version: 0.000
 Angular degrees versioning notation
 http://isprogrammingeasy.blogspot.no/2012/08/angular-degrees-versioning-notation.html

Compile test units with GCC:

	gcc -o arr-test arr-test.c -Wall

Arrays in C lack length and this is not very convenient.
This macro library require only including the header.

	#include "arr.h"

No struct declarations are necessary, here is an example:

	arr_init(double, a, 0.5, 0.25, 0.175);
	int i, n = arr_len(a);
	for (i = 0; i < n; i++) {
		printf("%g ", a[i]);
	}
	arr_free(a);

To allocate a N number of items, use

	arr_init_size(double, a, N);

See "arr.h" for more details.