praveenrpk92
Newbie level 6
I have all global variables in my project. Since RAM data size has almost become full, i wanted to replace some of the global variables with local variables in functions. But each local variable declaration seems to take up RAM space as if it is a global variable;
Assume I have few global variables and the data size is 10 bytes
now i add a new function
After compiling, lthis increases the data size to 20.
adding another function
After compiling, this again increases the data size to 30. What is the point of using local variables in this scenario? It works as if the the variables are declared globally. Shouldn't the data size be global variables 10 bytes + maximum local variable size i.e 10 bytes = 20 bytes total?
Is it better to declare the 10 variables as global once and save the 10 bytes?
Assume I have few global variables and the data size is 10 bytes
now i add a new function
Code:
void function1()
{
char var1,var2,var3,var4,var4,var5,var6,var7,var8,var9,var10;
}
After compiling, lthis increases the data size to 20.
adding another function
Code:
void function2()
{
char var1,var2,var3,var4,var4,var5,var6,var7,var8,var9,var10;
}
Is it better to declare the 10 variables as global once and save the 10 bytes?