array.c
//removes element at index param i from array at param ap
//if param i < 0, wrap once around array in reverse (i = length - i)
//if param p != NULL then sets *p to removed element
//returns 1 if success, 0 if fails (out of bounds)
removes element at index param i from array at param ap
if param i < 0, wrap once around array in reverse (i = length - i)
if param p != NULL then sets *p to removed element
returns 1 if success, 0 if fails (out of bounds)
removes element at index param i from array at param ap if param i < 0 wrap once around array in reverse ( i = length - i ) if param p ! = NULL then sets * p to removed element returns 1 if success 0 if fails ( out of bounds )
int array_remove(array_t* ap, int i, int* p) {
	if( i < 0 ) {
		i = ap->length + i;
	}
	if( (i > ap->length) || (i < 0) ) {
		WARN("index out of bounds for array remove");
		EXIT();
		return(0);
	}
	if( p ) { *p = ap->array[i]; }
	if( i!=ap->length ) {
		int j;
		for(j=i; j<ap->length-1; j++) {
			ap->array[j] = ap->array[j+1];
		}
	}
	ap->length--;
	return(1);
}
int array_remove ( array_t * ap , int i , int * p ) { if ( i < 0 ) { i = ap -> length + i ; } if ( ( i > ap -> length ) || ( i < 0 ) ) { WARN ( " " ) ; EXIT ( ) ; return ( 0 ) ; } if ( p ) { * p = ap -> array [ i ] ; } if ( i != ap -> length ) { int j ; for ( j = i ; j < ap -> length - 1 ; j ++ ) { ap -> array [ j ] = ap -> array [ j + 1 ] ; } } ap -> length -- ; return ( 1 ) ; }
removes element at index param i from array at param ap
if param i < 0, wrap once around array in reverse (i = length - i)
if param p != NULL then sets *p to removed element
returns 1 if success, 0 if fails (out of bounds)
removes element at index param i from array at param ap if param i < 0 wrap once around array in reverse ( i = length - i ) if param p ! = NULL then sets * p to removed element returns 1 if success 0 if fails ( out of bounds )