I am using the xc32 compiler for the microchip pic32 microcontroller.
The program memory size (for the startup, vectors and etc..) is 1656 bytes.
#include <plib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
//if I use const char array[] for string literal then the size of the program memory increased
//equal to the string length(only 12 bytes)
//const char array[] = "Hello World"; //program mem size(1668 0x684) bytes
//but in this case size increased 28 bytes
//const char *array = "Hello World"; //program mem size(1684 0x694) bytes
int main {
while(1);
}
for optimization purposes:
which one is good(for both speed and size)?
- #define STRLIT "HELLO WORLD"
- const char *strlit = "HELLO WORLD";
- const char arr[] = "HELLO WORLD"