It sounds like more like a stristr (from php, I don't remember the C equivalent if there is one).
If I understand correctly, this function finds the letter "x" in a string and returns it's position. I'll try to get you started, I think you'll understand this better if you do most of it yourself 
Code:
// Pseudo-code (will not compile in any language :P)
function findX(String)
for i = 0 to length(String)
if ... // figure out how to find what letter is at position "i" (your loop counter)
return i
else
return -1