#include int find_first_char(char *str, char find) { int i=0; while(str[i] != '\0') { if (str[i] == find) { return(i); } i++; } return(-1); } int main(void) { int res; char str[] = "test"; res = find_first_char(str, 'e'); printf("res is %d\n", res); return(0); }