Hello, I would like to understand why my code does not work. I'm trying to develop a galaxy application and I can not seem to get the letter typed to be compared to the letter in the vector, what am I doing wrong?
Follow the code:
#include<stdio.h>
#include<locale.h>
#include<time.h>
#include<stdlib.h>
#include<string.h>
int main (){
int i,len_palavra,exec=1,back;
char lacuna[20]="_";
char letra[20];
char palavra[4]="arroz";
setlocale(LC_ALL,"PORTUGUESE");
len_palavra = strlen(palavra);
for(i=1;i<=len_palavra;i++)
lacuna[i]='_';
while (exec == 1){
system("cls");
printf("\t\t%s\n",lacuna);
printf("\nDigite uma letra: ");
gets(letra);
for(i=0;i<len_palavra;i++){
if (letra[0] == palavra[i])
lacuna[i] == letra[0];
}
}
return 0;
}