src/list.c
/* Add an element to the list. */
Add an element to the list.
Add an element to the list .
void listAdd(List* l, void* e)
{
	if (l->size == l->cap)
	{
		l->cap *= 2;
		void** newArr = (void**) malloc(sizeof(void*) * l->cap);
		int i;
		for (i = 0; i < l->size; i++)
			newArr[i] = l->arr[i];
		free(l->arr);
		l->arr = newArr;
	}
	l->arr[l->size++] = e;
}
void listAdd ( List * l , void * e ) { if ( l -> size == l -> cap ) { l -> cap *= 2 ; void * * newArr = ( void * * ) malloc ( sizeof ( void * ) * l -> cap ) ; int i ; for ( i = 0 ; i < l -> size ; i ++ ) newArr [ i ] = l -> arr [ i ] ; free ( l -> arr ) ; l -> arr = newArr ; } l -> arr [ l -> size ++ ] = e ; }
Add an element to the list.
Add an element to the list .
// Expand stack