Not getting proper output with my for loop

Trying to write a function that takes a letter from user input and checks it against an already existing array. I tried tweaking it and playing around with different things but it seems to only be able to hold value to a single element at a time so I would have to change the code every single time I want it to produce a new element. Any tips or help would really be great

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
int CompareGuess(char actualWord[SIZE], char*letterGuess, int num)
{	
	int i;
			
	printf("Double checking game word is: %s\n", actualWord);
	printf("Testing len: %d\n", num);

	for (i=0; i<num; i++)
	{

		if (actualWord[i] == *letterGuess)
		{
			printf("Test the letter: %c\n", actualWord[i]);
			printf("Testing 'i': %d\n", i);
			return i;
		}
		else
		{
			printf("Test the letter: %c\n", actualWord[i]);
			printf("Your guess of '%c' was no good\n",*letterGuess);
			printf("Testing 'i': %d\n", i);
			return -1;
		}
	}
}
Topic archived. No new replies allowed.