#include <stdio.h>

char my_str[] = "hello42";

int char_exist(char c, char *str)
{
    int i;

    i = 0;
    while (str[i] != '\0')
    {
        if (str[i] == c)
        {
            return (1);
        }
        i++;
    }
    return (0);
}

int main() {
    if(char_exist('2', my_str))
    {
        printf("%d\n", char_exist('2', my_str) );
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: