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

I am 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 several times at the code 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 please help me? Until yesterday the code ran perfectly.

Author: Taisbevalle, 2016-10-12

2 answers

Usually this error occurs when you forgot to close a 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);

}
 2
Author: BrunoB, 2016-10-12 03:46:35

You put the function definition "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
 1
Author: zentrunix, 2016-10-12 05:07:20