REALLY need some tips on this simple letter guessing code
Its meant to return a 1 if the inputted char is in the word "asenine". and return 0 if it isnt, am i going about this the right way?
any help appreciated, thanks!
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _CRT_SECURE_NO_WARNINGS
int letterguess(char* text, int a);
int main(void)
{
char word[] = "asenine";
int x = strlen(word);
char input;
printf("%d", letterguess(word, x));
return 0;
}
int letterguess(char* text, int a)
{
char input;
scanf("%c", input);
for (int i = 0; i < a ; i++)
{
if (text[i] == input)
{
return 1;
}
else
{
return 0;
}
}
}