I've been trying to understand why I'm getting wrong output with this function. It must be somewhere where I count the chars in the array.
Here it goes.
Code:
int clean_array(char array[], char clean[], int size)
{
    int i, j = 0;

/* j is to count index of the array cleaned out of      */
/*blanks and punct marks. i is for the original array */ 

    for(i = 0; i < size; i++)
    {
       if( isalpha(array[i]) )
       {                                 /* if char is a letter, put it in the */
          clean[j] = array[i];   /* other array. Increment its index */
          j++;                
       }                      
    }
 
    clean[j] = '\0';      /* as index is incremented already, just */     
                                /* close the string */
 
    return (j-1);         /* return the number of chars in string */       
}
So, when I input a random choice of chars, e.g
jhy ut!
and store it in the original array, the program cleans it up correctly and my result is (using puts):
jhyutP
The last letter I believe is something random, maybe from outside of the clean string.
What did I do wrong with the subscripting?