Here is what I have so far...
Code:
#include <stdio.h>
#define SIZE 20
char word[SIZE];
char guess[SIZE];
#define STAR '*'
int main (void)
{
printf("Enter a word > ");
int i = 0;
do {
word[i]=getchar();
i++;
} while (word[i-1] != '\n');
int num_stars = i - 1;
printf("%d", num_stars);
char search;
printf("\nGuess a letter > ");
scanf("%c", &search);
for( i = 0; i < SIZE; i++ )
{
if( word[i] == search ) break;
}
if( i == SIZE ) printf("%c was not found!", search);
else
printf("%c = %c and was located at position %d\n\n", search, word[i], i);
return 0;
}
I want to have an array "guess" that will take the number of letters of the word the user enters and make them *'s. So for example the user enters word. I want the guess array to look like ****
Can anybody help me with this?