In C Programming How to display possible guesses in an A to

In C Programming...

How to display possible guesses in an A to Z array.... and then remove letters from the array as they are guessed by a user.

Basically, I need help making a function to call in the main function during a loop for a Hangman game.

That says:

Letters to choose from: A B C D E F.... etc...

and then if they user guesses a \"D\" that one will be removed from the list. and won\'t display... so it will say:

Letters to choose from A B C E F G.... etc

Solution

int main()

{

char arr[5]={A,BC,D,E};

arr=func(arr,\'C\');

printf(\"%s\",arr);

return 0;

}

char[] func(char arr[],char ch)

{

int ind;

for(int i=0;i<arr.length;i++)

{

if(arr[i]==ch)

ind=i;

}

for(int i=ind;i<arr.length-1;i++)

{

arr[i]=arr[i+1];

}

return arr;

}

In C Programming... How to display possible guesses in an A to Z array.... and then remove letters from the array as they are guessed by a user. Basically, I ne

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site