C remove element from dynamic array
===

I'm trying to write the equivalent of remove for a Java ArrayList in C.

Here is my code. It assumes that index is a valid index in the list.

    void arrayListRemove(ArrayList* list, int index){
	    int i;
	    if (arrayListSize(list)==1){
	       list->size = 0;
	       free(list->data);
	       list->data = NULL;		
	     } else {
		for(i=index;i<arrayListSize(list)-1;i++){
			list->data[i] = list->data[i+1];
		}
		list->data = realloc(list->data, (arrayListSize(list) - 1) * sizeof(void*));
		if (list->data != NULL){
			--list->size;
		} else {
			exit(1);
		}
	}
    }

Is this correct? 