a function-definition is not allowed here before '{' what does this error mean?

0

I'm trying to compile my code, but the compilation returns the following error:

  

a function-definition is not allowed here before '{' token |

I am a beginner and have looked at the code several times to understand what may be happening, but I did not find the source of the error.

void menuAlunoCurso(){

        opcao = 0;
        system("cls");
        printf("\t\t\tSisCA - Menu do Matriculado *****");
        printf("\n\n\t\t\t *** Escolha uma opção ***");
        printf("\n\t\t\t 1------Cadastrar");
        printf("\n\t\t\t 2------Exibir");
        printf("\n\t\t\t 3------Pesquisar");
        printf("\n\t\t\t 4------Remover");
        printf("\n\t\t\t 7------Voltar ao menu anterior");
        printf("\n\n\t\t\tOpção: ");
        scanf("%d",&opcao);

    }

Could someone help me, please? Until yesterday the code was running perfectly.

    
asked by anonymous 12.10.2016 / 02:54

2 answers

1

Usually this error occurs when you forgot to close some key in the previous function

Example:

void outraFuncao(){
    //
    // Codigo da função...
    //
// Falta o } para essa função

void menuAlunoCurso(){

    opcao = 0;
    system("cls");
    printf("\t\t\tSisCA - Menu do Matriculado *****");
    printf("\n\n\t\t\t *** Escolha uma opção ***");
    printf("\n\t\t\t 1------Cadastrar");
    printf("\n\t\t\t 2------Exibir");
    printf("\n\t\t\t 3------Pesquisar");
    printf("\n\t\t\t 4------Remover");
    printf("\n\t\t\t 7------Voltar ao menu anterior");
    printf("\n\n\t\t\tOpção: ");
    scanf("%d",&opcao);

}
    
12.10.2016 / 05:46
1

You have put the definition of the function "menuAlunoCurso" before the final key "}" of the previous function.

Something like this:

void func()
{
    // bla
    // bla
    // bla

void menuAlunoCurso(){
   // bla
   // bla
   // bla
} // chave final de menuAlunoCurso 

} // chave final de func
    
12.10.2016 / 05:46