#include <stdio.h>

#define BUFF_SZ 256

int str_char(const char s[], int c) {
    int idx = 0;
    while (s[idx] != '\0') {
        if (s[idx] == (char)c) {
            return idx + 1;
        }
        idx++;
    }

    return -1;
}

int main(void) {
    char buff[BUFF_SZ] = {0};
    char query = 0;
    
    printf("Input String: ");
    fgets(buff, BUFF_SZ, stdin);

    printf("Input Search Character: ");
    scanf("%c", &query);

    printf("%c, %s\n", query, buff);

    int ret = str_char(buff, query);
    if (ret != -1) {
        printf("Found %c at %d\n", query, ret);
    } else {
        printf("Queried character not found.\n");
    }

    return 0;
}

