Do your own homework please. It's bad enough that people depend on formal schooling to learn how to program, but it's even worse when they don't even learn the concepts they are supposed to. Normally I wouldn't care if someone wanted homework help. But in the programming world, there are already enough bad programmers writing b***y code.
Here's some quick pseudocode to show you what you should do:
[PHP]int GetPosOfString(char[] input) {
for (int i = 0, i < sizeof(input), i++) {
if (input[i] = "x")
return i;
}
return -*;
}[/PHP]
"Workers of the world unite; you have nothing to lose but your chains." -Karl Marx