Answer the question
In order to leave comments, you need to log in
How to implement a separate scope in 1 sishnik?
Hello. There is 1 si file. It has 1 variable and 3 functions. The variable must work with 2 functions, and the remaining function must not be able to work with it. Is it possible to implement this in one file? Or not? I tried to do it with curly braces, but it's impossible outside the function.
Answer the question
In order to leave comments, you need to log in
Perhaps of course. For example, do not make the variable global, but declare it in main and pass pointers to two other functions.
It is not entirely clear what a variable means should work with functions. Perhaps you meant that the variable should be accessible from functions. Then the solution in the forehead:
функция1()
переменная
функция2()
функция3()
функция1()
функция2(переменная*)
функция3(переменная*)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question