0

I'm trying to understand the memory model of C and I wrote this code:

int main(int argc, char** argv){

static int addr0 = 2;
static int addr1;
printf("- addr0: %p\n", & addr0);
printf("- addr1: %p\n",&addr1);
return 0;
}

And the output was:

- addr0: 0x55e8f4094010
- addr1: 0x55e8f4094018

I did not understand why the difference between those variables was 8 and not 4, since they were allocated in sequence. In addition, where they were allocated? .bss? .data?

chendoy
  • 155
  • 1
  • 2
  • 12

0 Answers0