In C++, we can avoid non-const globals by using a class with a private variable and getter and setter functions. How is this handled in C, since it doesn't have classes?
Like, if I have two different functions that each need access to the same variable and need to be able to change it, is there any way to do that without using a global variable?
Posted May 4, 2022, 1:48 AM UTC
215