A noob question: I created a library called funcoes.h that have a menu() and other functions that can call menu(). An example:
void cifrar(){
printf("\n\nDeseja cifrar outra mensagem? Digite 1 para Sim ou 2 para sair: ");
scanf("%d", &exit);
if(exit == 1){
cifrar();
}
else{
menu();
}
}
void menu(){
printf("Escolha uma das opcoes: ");
scanf("%d", &varMenu);
switch(varMenu){
case 1:
system("cls");
cifrar();
break;
case 2:
system("cls");
decifrar();
break;
case 3:
system("cls");
sair();
break;
default:
system("cls");
printf("Escolha uma opcao valida!\n\n");
menu();
break;
}
}
But when I compile, I have this error:
In function 'void cifrar()'
'menu' undeclared(first use this function)"
'void menu()' used prior to declaration
How to make them call each other without this error?
Thanks!
every function that you call has to be declared BEFORE that call. you can do this by using a prototype of that function:
or simply by putting the whole main function (with it's body) on top of cifrar.