Your countChar function is a bit of a mess. The first loop and x are completely useless; you can get the last character with just character + length - 1. But you don't even need that; you can just loop starting at i = 0, and run while i < length using a for loop. The for loop you do use does nothing but set first = last and set y = 0 a bunch of times, because you have no braces with it. Don't even know what that second while loop is doing.
Basically, I would suggest using a better for loop like I suggested to loop through each character. Then, have another array of ints with 26 elements, all initialized to 0, and whenever you get a certain character you increment the appropriate element of the int array (you can just subtract the ASCII value of 'a' from the character itself to get a number 0-25 to use for indexing the array). Once you've gone through all the letters, just find the largest value in the array of ints and you're done. Your function should probably return the char that occurs the most often, rather than nothing.