0
The idea of the program is to be a dictionary, the user informs the word, the program performs a check on the characters of the word finds the position in the vector and returns the definition if the word is in the dictionary.
The problem is q it never returns error of word a found, only the first definition or the second :/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h> //lider com variaveis booleans
#define NUM_DEF 7
struct dicionario
{
    char palavra[20];
    char definicao[50];
};
//confere os caracteres das palavras
bool compString(const char palavra1[], const char palavra2[])
{
    int i = 0;
    while (palavra1[i] == palavra2[i] && palavra1[i] != '\0' && palavra2[i] != '\0')
    {
        ++i;
    }
    if (palavra1[i] == '\0' && palavra2[i] == '\0')
    {
        return true;
    }
    else
    {
        return false;
    }
}
//busca a palavra no dicionario
int procString(const struct dicionario lingua[], const char procurar[], int numPalavra)
{
    bool compString(const char palavra1[], const char palavra2[]);
    int i = 0;
    while (i < numPalavra)
    {
        if (compString(procurar, lingua[i].palavra))
        {
            return i;
        }
        else
        {
            return ++i;
        }
    }
    return -1;
}
int main(void)
{
    int procString(const struct dicionario lingua[], const char procurar[], const int numPalavra);
    char palavra[20] = {'\0'};
    int resultPesq;
    const struct dicionario portu[NUM_DEF] = {
        {"pao", "comida de farinha"},
        {"feijao", "comida brasileira"},
        {"tropeiro", "tipo de feijao"},
        {"queijo", "comida de minas"},
        {"macarrao", "comida de vo"},
        {"mortadela", "comida de carne"},
        {"pizza", "comida da italia"}};
    printf("Digite uma palavra:\n");
    scanf("%s", &palavra);
    resultPesq = procString(portu, palavra, NUM_DEF);
    if (resultPesq != -1)
    {
        printf("%s\n", portu[resultPesq].definicao);
    }
    else
    {
        printf("Palavra n encontrada");
    }
    return 0;
}