while(quotient != 0){
int temp, length = 1;
length is always 1 in this loop.
change to
int length = 1;
while(quotient != 0){
int temp;
realloc is performed once at the end
array = realloc(array, (length)*sizeof(char));
move outside while loop
}//while end
array = realloc(array, (length)*sizeof(char));
The following conditions is incorrect
while((k <= ((j/2)+1))){
....
while(k <= (((j)/2))){
change to
int L = j/2;
...
while(k <= L){
...
while(k <= L-1){
To summarize in one
if( j%2 == 1)
L=j/2;
else
L=j/2-1;
while(k <= L){
temp = array[k];
array[k] = array[j];
array[j] = temp;
k = k+1;
j = j - 1;
}