Calling a variable from an other function and using it in an other fuction
Hello,
I am a bit confused over the variables and the fuction declarations in C. I am coming from a 3 year python trip and it feels a bit odd but i really like it. This is my code
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
void starting_screen(void);
void selection_loader(int option);
int main()
{
starting_screen();
printf("~~~~~~~~~~~~~~~~~~Choose option~~~~~~~~~~~~~~~~~~~~~~");
int option;
scanf("%d", &option);
starting_screen();
selection_loader(option);
return 0;
}
void starting_screen(void)
{
//starting screen
printf("\n");
printf("\n");
printf("\n");
printf("1.Mini text editor");
printf("\n");
printf("2.Insert text");
printf("\n");
printf("3.Import dictionary");
printf("\n");
printf("4.Edit text");
printf("\n");
printf("5.write and save text");
printf("\n");
printf("6.Calculate statistic data");
printf("\n");
printf("7.Escape this hell");
printf("\n");
}
int selection_loader(option)
{
if (option == 7) {
exit(0);
}
}
I want the selection_loader function to see the option variable and act accordingly the if statement. I am 100% sure that my function declaration is wrong. Thanks!