You cannot do that in C: the language does not support overloads or default parameters. The only thing that you can do to emulate this would be using variable number of parameters, but that would not work here, because you would need to pass an additional parameter indicating the type of the item being searched.
A better approach would be defining two functions
int indexOfChar(char *text, char letter)
int indexOfWord(char *text, char *wors)
or better yet, using the corresponding functions from the standard library - strchr
and strstr
.