Pointers, seeing there's only 2k of RAM, are they only 2 bytes long or something like 4 bytes?
Thanks!
-jim lee
Pointers, seeing there's only 2k of RAM, are they only 2 bytes long or something like 4 bytes?
Thanks!
-jim lee
Memory is single bytes.
2KB (2048) of SRAM in an Atmega 328
A pointer will have a "type"
You need two bytes to store a pointer.
.
2 bytes to store. Thanks!
if you have a serial console, the best is to print sizeof(void*)to know for sure.
sonyhome:
if you have a serial console, the best is to print sizeof(void*)to know for sure.
If you ever have something static like this you would like to prove, you can get the compiler to do it for you, rather than having to upload a whole sketch.
This code will fail to compile if sizeof(void*) is not 2.
If it compiles, then you know your assumption was correct.
bool pointer_size[ sizeof(void*) == 2 ? 1 : -1 ];
void setup() {
}
void loop() {
}
@pYro_65: Slick! I would have just printed out the sizeof(void *).