To optimize the memory size of program(for microcontrollers)
1. If you are working with 8 bit of data or no. between 0 to 255 then use char datatype.
Example:
int j = 0;
for ( j = 0; j<=100 ; j++);
Here instead of int use char. It will help u in optimizing program by a bunch of byte.
2. Use just if rather than if-else or switch or array. It saves a lot of space.
3. Design your own algorithm for any data (in which there are options to be selected) which can be obtainded by just subtracting or adding a no. or combination rather than using switch or if-else statements.
4. Always try to design a nice logic, because you have brain.
more to come... till then enjoy programming..
1. If you are working with 8 bit of data or no. between 0 to 255 then use char datatype.
Example:
int j = 0;
for ( j = 0; j<=100 ; j++);
Here instead of int use char. It will help u in optimizing program by a bunch of byte.
2. Use just if rather than if-else or switch or array. It saves a lot of space.
3. Design your own algorithm for any data (in which there are options to be selected) which can be obtainded by just subtracting or adding a no. or combination rather than using switch or if-else statements.
4. Always try to design a nice logic, because you have brain.
more to come... till then enjoy programming..
No comments:
Post a Comment