a program uses different regions of memory for static objects, automatic objects, and dynamically allocated objects

Clash Royale CLAN TAG#URR8PPP
up vote
7
down vote
favorite
I am following the book "C Primer Plus" and encounter problem to understand the regions of memory;
In the book, it states:
Typically, a program uses different regions of memory for static objects, automatic objects, and dynamically allocated objects. Listing 12.15 illustrates this point.
// where.c -- where's the memory?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int static_store = 30;
const char * pcg = "String Literal";
int main(void)
int auto_store = 40;
char auto_string = "Auto char Array";
int *pi;
char *pcl;
pi = (int *) malloc(sizeof(int));
*pi = 35;
pcl = (char *) malloc(strlen("Dynamic String") + 1);
strcpy(pcl, "Dynamic String");
printf("static_store: %d at %pn", static_store, &static_store);
printf(" auto_store: %d at %pn", auto_store, &auto_store);
printf(" *pi: %d at %pn", *pi, pi);
printf(" %s at %pn", pcg, pcg);
printf(" %s at %pn", auto_string, auto_string);
printf(" %s at %pn", pcl, pcl);
printf(" %s at %pn", "Quoted String", "Quoted String");
free(pi);
free(pcl);
return 0;
Run the code and get:
static_store: 30 at 0x10a621040
auto_store: 40 at 0x7ffee55df768
*pi: 35 at 0x7fbf1d402ac0
String Literal at 0x10a620f00
Auto char Array at 0x7ffee55df770
Dynamic String at 0x7fbf1d402ad0
Quoted String at 0x10a620f9b
the book's conclusion:
As you can see, static data, including string literals occupies one region, automatic data a second region, and dynamically allocated data a third region (often called a memory heap or free store).
I could figure out they are of different address, how could I assure that they are of different regions?
c
add a comment |Â
up vote
7
down vote
favorite
I am following the book "C Primer Plus" and encounter problem to understand the regions of memory;
In the book, it states:
Typically, a program uses different regions of memory for static objects, automatic objects, and dynamically allocated objects. Listing 12.15 illustrates this point.
// where.c -- where's the memory?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int static_store = 30;
const char * pcg = "String Literal";
int main(void)
int auto_store = 40;
char auto_string = "Auto char Array";
int *pi;
char *pcl;
pi = (int *) malloc(sizeof(int));
*pi = 35;
pcl = (char *) malloc(strlen("Dynamic String") + 1);
strcpy(pcl, "Dynamic String");
printf("static_store: %d at %pn", static_store, &static_store);
printf(" auto_store: %d at %pn", auto_store, &auto_store);
printf(" *pi: %d at %pn", *pi, pi);
printf(" %s at %pn", pcg, pcg);
printf(" %s at %pn", auto_string, auto_string);
printf(" %s at %pn", pcl, pcl);
printf(" %s at %pn", "Quoted String", "Quoted String");
free(pi);
free(pcl);
return 0;
Run the code and get:
static_store: 30 at 0x10a621040
auto_store: 40 at 0x7ffee55df768
*pi: 35 at 0x7fbf1d402ac0
String Literal at 0x10a620f00
Auto char Array at 0x7ffee55df770
Dynamic String at 0x7fbf1d402ad0
Quoted String at 0x10a620f9b
the book's conclusion:
As you can see, static data, including string literals occupies one region, automatic data a second region, and dynamically allocated data a third region (often called a memory heap or free store).
I could figure out they are of different address, how could I assure that they are of different regions?
c
1
You can see thatstatic_store,String LiteralandQuoted Stringare roughly in the same "memory region" (0x10a62xxx). So areauto_storeandAuto char Array(0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).
â Jabberwocky
1 hour ago
add a comment |Â
up vote
7
down vote
favorite
up vote
7
down vote
favorite
I am following the book "C Primer Plus" and encounter problem to understand the regions of memory;
In the book, it states:
Typically, a program uses different regions of memory for static objects, automatic objects, and dynamically allocated objects. Listing 12.15 illustrates this point.
// where.c -- where's the memory?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int static_store = 30;
const char * pcg = "String Literal";
int main(void)
int auto_store = 40;
char auto_string = "Auto char Array";
int *pi;
char *pcl;
pi = (int *) malloc(sizeof(int));
*pi = 35;
pcl = (char *) malloc(strlen("Dynamic String") + 1);
strcpy(pcl, "Dynamic String");
printf("static_store: %d at %pn", static_store, &static_store);
printf(" auto_store: %d at %pn", auto_store, &auto_store);
printf(" *pi: %d at %pn", *pi, pi);
printf(" %s at %pn", pcg, pcg);
printf(" %s at %pn", auto_string, auto_string);
printf(" %s at %pn", pcl, pcl);
printf(" %s at %pn", "Quoted String", "Quoted String");
free(pi);
free(pcl);
return 0;
Run the code and get:
static_store: 30 at 0x10a621040
auto_store: 40 at 0x7ffee55df768
*pi: 35 at 0x7fbf1d402ac0
String Literal at 0x10a620f00
Auto char Array at 0x7ffee55df770
Dynamic String at 0x7fbf1d402ad0
Quoted String at 0x10a620f9b
the book's conclusion:
As you can see, static data, including string literals occupies one region, automatic data a second region, and dynamically allocated data a third region (often called a memory heap or free store).
I could figure out they are of different address, how could I assure that they are of different regions?
c
I am following the book "C Primer Plus" and encounter problem to understand the regions of memory;
In the book, it states:
Typically, a program uses different regions of memory for static objects, automatic objects, and dynamically allocated objects. Listing 12.15 illustrates this point.
// where.c -- where's the memory?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int static_store = 30;
const char * pcg = "String Literal";
int main(void)
int auto_store = 40;
char auto_string = "Auto char Array";
int *pi;
char *pcl;
pi = (int *) malloc(sizeof(int));
*pi = 35;
pcl = (char *) malloc(strlen("Dynamic String") + 1);
strcpy(pcl, "Dynamic String");
printf("static_store: %d at %pn", static_store, &static_store);
printf(" auto_store: %d at %pn", auto_store, &auto_store);
printf(" *pi: %d at %pn", *pi, pi);
printf(" %s at %pn", pcg, pcg);
printf(" %s at %pn", auto_string, auto_string);
printf(" %s at %pn", pcl, pcl);
printf(" %s at %pn", "Quoted String", "Quoted String");
free(pi);
free(pcl);
return 0;
Run the code and get:
static_store: 30 at 0x10a621040
auto_store: 40 at 0x7ffee55df768
*pi: 35 at 0x7fbf1d402ac0
String Literal at 0x10a620f00
Auto char Array at 0x7ffee55df770
Dynamic String at 0x7fbf1d402ad0
Quoted String at 0x10a620f9b
the book's conclusion:
As you can see, static data, including string literals occupies one region, automatic data a second region, and dynamically allocated data a third region (often called a memory heap or free store).
I could figure out they are of different address, how could I assure that they are of different regions?
c
c
asked 1 hour ago
rider dragon
1315
1315
1
You can see thatstatic_store,String LiteralandQuoted Stringare roughly in the same "memory region" (0x10a62xxx). So areauto_storeandAuto char Array(0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).
â Jabberwocky
1 hour ago
add a comment |Â
1
You can see thatstatic_store,String LiteralandQuoted Stringare roughly in the same "memory region" (0x10a62xxx). So areauto_storeandAuto char Array(0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).
â Jabberwocky
1 hour ago
1
1
You can see that
static_store, String Literal and Quoted String are roughly in the same "memory region" (0x10a62xxx). So are auto_store and Auto char Array (0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).â Jabberwocky
1 hour ago
You can see that
static_store, String Literal and Quoted String are roughly in the same "memory region" (0x10a62xxx). So are auto_store and Auto char Array (0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).â Jabberwocky
1 hour ago
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
8
down vote
accepted
Because different regions have very different addresses. If they were in the same region, they would have similar addresses. Better example, where we allocate 2 objects in each region:
#include <stdio.h>
#include <stdlib.h>
int main (void)
int stack1;
int stack2;
static int bss1;
static int bss2;
static int data1=1;
static int data2=1;
int* heap1 = malloc(1);
int* heap2 = malloc(1);
char* rodata1 = "hello";
char* rodata2 = "world";
printf(".stackt%p %pn", &stack1, &stack2);
printf(".bsst%p %pn", &bss1, &bss2);
printf(".datat%p %pn", &data1, &data2);
printf(".heapt%p %pn", heap1, heap2);
printf(".rodatat%p %pn", rodata1, rodata2);
free(heap1);
free(heap2);
Output (for example):
.stack 000000000022FE2C 000000000022FE28
.bss 0000000000407030 0000000000407034
.data 0000000000403010 0000000000403014
.heap 0000000000477C50 0000000000477C70
.rodata 0000000000404000 0000000000404006
As you can see the two variables in the same segment have nearly identical addresses, the only difference being the size of the objects (and possibly some room for alignment). While they have very different addresses compared to variables on the other rows.
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
add a comment |Â
up vote
5
down vote
The C standard states that an object can have one of 4 different storage durations. These are:
- static
- automatic
- allocated
- thread
The code above addresses the first 3 of these.
A static object is is declared either at file scope or at local scope with the static modifier. String literals are also static objects.
An automatic object, typically referred to as a local variable, it declared within a function or an enclosing scope.
An allocated object is one whose memory is returned by an allocation function such as malloc.
In practice, compilers will typically place each of these object types in a different area of memory. Static objects are typically placed in the data section of an executable, automatic (read: local) objects are typically stored on the stack, and allocated objects are typically stored on the heap.
String literals in particular are static objects, and are typically placed in a special part of the data section marked read-only.
These regions are typically in different distinct regions of memory, however they are not required to be. So while in practice the addresses of objects in each of these regions will be noticeably different, they aren't required to be.
So you don't really need to "assure" that different types of variables are in different regions. The compiler takes care of that for you depending on how you define them.
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
add a comment |Â
up vote
1
down vote
What might help a bit to get the actual sections allocated for the program is the nm command, there you could e.g. see the static_store offset.
static_store: 30 at 0x600b00
==> 0000000000600b00 D static_store
See it live on coliru: http://coliru.stacked-crooked.com/a/1b45e01f508ec7b7
Note the attached nm command:gcc main.cpp && ./a.out && nm a.out
However, you have to keep in mind that you're typically on a system with MMU thus having virtual memory addresses mapped to real memory.
Find more infos e.g. on https://www.embeddedrelated.com/showarticle/900.php
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
8
down vote
accepted
Because different regions have very different addresses. If they were in the same region, they would have similar addresses. Better example, where we allocate 2 objects in each region:
#include <stdio.h>
#include <stdlib.h>
int main (void)
int stack1;
int stack2;
static int bss1;
static int bss2;
static int data1=1;
static int data2=1;
int* heap1 = malloc(1);
int* heap2 = malloc(1);
char* rodata1 = "hello";
char* rodata2 = "world";
printf(".stackt%p %pn", &stack1, &stack2);
printf(".bsst%p %pn", &bss1, &bss2);
printf(".datat%p %pn", &data1, &data2);
printf(".heapt%p %pn", heap1, heap2);
printf(".rodatat%p %pn", rodata1, rodata2);
free(heap1);
free(heap2);
Output (for example):
.stack 000000000022FE2C 000000000022FE28
.bss 0000000000407030 0000000000407034
.data 0000000000403010 0000000000403014
.heap 0000000000477C50 0000000000477C70
.rodata 0000000000404000 0000000000404006
As you can see the two variables in the same segment have nearly identical addresses, the only difference being the size of the objects (and possibly some room for alignment). While they have very different addresses compared to variables on the other rows.
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
add a comment |Â
up vote
8
down vote
accepted
Because different regions have very different addresses. If they were in the same region, they would have similar addresses. Better example, where we allocate 2 objects in each region:
#include <stdio.h>
#include <stdlib.h>
int main (void)
int stack1;
int stack2;
static int bss1;
static int bss2;
static int data1=1;
static int data2=1;
int* heap1 = malloc(1);
int* heap2 = malloc(1);
char* rodata1 = "hello";
char* rodata2 = "world";
printf(".stackt%p %pn", &stack1, &stack2);
printf(".bsst%p %pn", &bss1, &bss2);
printf(".datat%p %pn", &data1, &data2);
printf(".heapt%p %pn", heap1, heap2);
printf(".rodatat%p %pn", rodata1, rodata2);
free(heap1);
free(heap2);
Output (for example):
.stack 000000000022FE2C 000000000022FE28
.bss 0000000000407030 0000000000407034
.data 0000000000403010 0000000000403014
.heap 0000000000477C50 0000000000477C70
.rodata 0000000000404000 0000000000404006
As you can see the two variables in the same segment have nearly identical addresses, the only difference being the size of the objects (and possibly some room for alignment). While they have very different addresses compared to variables on the other rows.
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
add a comment |Â
up vote
8
down vote
accepted
up vote
8
down vote
accepted
Because different regions have very different addresses. If they were in the same region, they would have similar addresses. Better example, where we allocate 2 objects in each region:
#include <stdio.h>
#include <stdlib.h>
int main (void)
int stack1;
int stack2;
static int bss1;
static int bss2;
static int data1=1;
static int data2=1;
int* heap1 = malloc(1);
int* heap2 = malloc(1);
char* rodata1 = "hello";
char* rodata2 = "world";
printf(".stackt%p %pn", &stack1, &stack2);
printf(".bsst%p %pn", &bss1, &bss2);
printf(".datat%p %pn", &data1, &data2);
printf(".heapt%p %pn", heap1, heap2);
printf(".rodatat%p %pn", rodata1, rodata2);
free(heap1);
free(heap2);
Output (for example):
.stack 000000000022FE2C 000000000022FE28
.bss 0000000000407030 0000000000407034
.data 0000000000403010 0000000000403014
.heap 0000000000477C50 0000000000477C70
.rodata 0000000000404000 0000000000404006
As you can see the two variables in the same segment have nearly identical addresses, the only difference being the size of the objects (and possibly some room for alignment). While they have very different addresses compared to variables on the other rows.
Because different regions have very different addresses. If they were in the same region, they would have similar addresses. Better example, where we allocate 2 objects in each region:
#include <stdio.h>
#include <stdlib.h>
int main (void)
int stack1;
int stack2;
static int bss1;
static int bss2;
static int data1=1;
static int data2=1;
int* heap1 = malloc(1);
int* heap2 = malloc(1);
char* rodata1 = "hello";
char* rodata2 = "world";
printf(".stackt%p %pn", &stack1, &stack2);
printf(".bsst%p %pn", &bss1, &bss2);
printf(".datat%p %pn", &data1, &data2);
printf(".heapt%p %pn", heap1, heap2);
printf(".rodatat%p %pn", rodata1, rodata2);
free(heap1);
free(heap2);
Output (for example):
.stack 000000000022FE2C 000000000022FE28
.bss 0000000000407030 0000000000407034
.data 0000000000403010 0000000000403014
.heap 0000000000477C50 0000000000477C70
.rodata 0000000000404000 0000000000404006
As you can see the two variables in the same segment have nearly identical addresses, the only difference being the size of the objects (and possibly some room for alignment). While they have very different addresses compared to variables on the other rows.
answered 1 hour ago
Lundin
103k16151254
103k16151254
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
add a comment |Â
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
(String literals don't necessarily end up in .rodata, but you get the idea)
â Lundin
1 hour ago
add a comment |Â
up vote
5
down vote
The C standard states that an object can have one of 4 different storage durations. These are:
- static
- automatic
- allocated
- thread
The code above addresses the first 3 of these.
A static object is is declared either at file scope or at local scope with the static modifier. String literals are also static objects.
An automatic object, typically referred to as a local variable, it declared within a function or an enclosing scope.
An allocated object is one whose memory is returned by an allocation function such as malloc.
In practice, compilers will typically place each of these object types in a different area of memory. Static objects are typically placed in the data section of an executable, automatic (read: local) objects are typically stored on the stack, and allocated objects are typically stored on the heap.
String literals in particular are static objects, and are typically placed in a special part of the data section marked read-only.
These regions are typically in different distinct regions of memory, however they are not required to be. So while in practice the addresses of objects in each of these regions will be noticeably different, they aren't required to be.
So you don't really need to "assure" that different types of variables are in different regions. The compiler takes care of that for you depending on how you define them.
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
add a comment |Â
up vote
5
down vote
The C standard states that an object can have one of 4 different storage durations. These are:
- static
- automatic
- allocated
- thread
The code above addresses the first 3 of these.
A static object is is declared either at file scope or at local scope with the static modifier. String literals are also static objects.
An automatic object, typically referred to as a local variable, it declared within a function or an enclosing scope.
An allocated object is one whose memory is returned by an allocation function such as malloc.
In practice, compilers will typically place each of these object types in a different area of memory. Static objects are typically placed in the data section of an executable, automatic (read: local) objects are typically stored on the stack, and allocated objects are typically stored on the heap.
String literals in particular are static objects, and are typically placed in a special part of the data section marked read-only.
These regions are typically in different distinct regions of memory, however they are not required to be. So while in practice the addresses of objects in each of these regions will be noticeably different, they aren't required to be.
So you don't really need to "assure" that different types of variables are in different regions. The compiler takes care of that for you depending on how you define them.
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
add a comment |Â
up vote
5
down vote
up vote
5
down vote
The C standard states that an object can have one of 4 different storage durations. These are:
- static
- automatic
- allocated
- thread
The code above addresses the first 3 of these.
A static object is is declared either at file scope or at local scope with the static modifier. String literals are also static objects.
An automatic object, typically referred to as a local variable, it declared within a function or an enclosing scope.
An allocated object is one whose memory is returned by an allocation function such as malloc.
In practice, compilers will typically place each of these object types in a different area of memory. Static objects are typically placed in the data section of an executable, automatic (read: local) objects are typically stored on the stack, and allocated objects are typically stored on the heap.
String literals in particular are static objects, and are typically placed in a special part of the data section marked read-only.
These regions are typically in different distinct regions of memory, however they are not required to be. So while in practice the addresses of objects in each of these regions will be noticeably different, they aren't required to be.
So you don't really need to "assure" that different types of variables are in different regions. The compiler takes care of that for you depending on how you define them.
The C standard states that an object can have one of 4 different storage durations. These are:
- static
- automatic
- allocated
- thread
The code above addresses the first 3 of these.
A static object is is declared either at file scope or at local scope with the static modifier. String literals are also static objects.
An automatic object, typically referred to as a local variable, it declared within a function or an enclosing scope.
An allocated object is one whose memory is returned by an allocation function such as malloc.
In practice, compilers will typically place each of these object types in a different area of memory. Static objects are typically placed in the data section of an executable, automatic (read: local) objects are typically stored on the stack, and allocated objects are typically stored on the heap.
String literals in particular are static objects, and are typically placed in a special part of the data section marked read-only.
These regions are typically in different distinct regions of memory, however they are not required to be. So while in practice the addresses of objects in each of these regions will be noticeably different, they aren't required to be.
So you don't really need to "assure" that different types of variables are in different regions. The compiler takes care of that for you depending on how you define them.
edited 1 hour ago
answered 1 hour ago
dbush
84.9k1090121
84.9k1090121
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
add a comment |Â
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
1
1
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
Can you address this question? "how could I assure that they are of different regions"
â Tim Randall
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
@TimRandall I added more detail at the end regarding that.
â dbush
1 hour ago
add a comment |Â
up vote
1
down vote
What might help a bit to get the actual sections allocated for the program is the nm command, there you could e.g. see the static_store offset.
static_store: 30 at 0x600b00
==> 0000000000600b00 D static_store
See it live on coliru: http://coliru.stacked-crooked.com/a/1b45e01f508ec7b7
Note the attached nm command:gcc main.cpp && ./a.out && nm a.out
However, you have to keep in mind that you're typically on a system with MMU thus having virtual memory addresses mapped to real memory.
Find more infos e.g. on https://www.embeddedrelated.com/showarticle/900.php
add a comment |Â
up vote
1
down vote
What might help a bit to get the actual sections allocated for the program is the nm command, there you could e.g. see the static_store offset.
static_store: 30 at 0x600b00
==> 0000000000600b00 D static_store
See it live on coliru: http://coliru.stacked-crooked.com/a/1b45e01f508ec7b7
Note the attached nm command:gcc main.cpp && ./a.out && nm a.out
However, you have to keep in mind that you're typically on a system with MMU thus having virtual memory addresses mapped to real memory.
Find more infos e.g. on https://www.embeddedrelated.com/showarticle/900.php
add a comment |Â
up vote
1
down vote
up vote
1
down vote
What might help a bit to get the actual sections allocated for the program is the nm command, there you could e.g. see the static_store offset.
static_store: 30 at 0x600b00
==> 0000000000600b00 D static_store
See it live on coliru: http://coliru.stacked-crooked.com/a/1b45e01f508ec7b7
Note the attached nm command:gcc main.cpp && ./a.out && nm a.out
However, you have to keep in mind that you're typically on a system with MMU thus having virtual memory addresses mapped to real memory.
Find more infos e.g. on https://www.embeddedrelated.com/showarticle/900.php
What might help a bit to get the actual sections allocated for the program is the nm command, there you could e.g. see the static_store offset.
static_store: 30 at 0x600b00
==> 0000000000600b00 D static_store
See it live on coliru: http://coliru.stacked-crooked.com/a/1b45e01f508ec7b7
Note the attached nm command:gcc main.cpp && ./a.out && nm a.out
However, you have to keep in mind that you're typically on a system with MMU thus having virtual memory addresses mapped to real memory.
Find more infos e.g. on https://www.embeddedrelated.com/showarticle/900.php
answered 1 hour ago
yussuf
16719
16719
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52855674%2fa-program-uses-different-regions-of-memory-for-static-objects-automatic-objects%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password

1
You can see that
static_store,String LiteralandQuoted Stringare roughly in the same "memory region" (0x10a62xxx). So areauto_storeandAuto char Array(0x7ffee55df). The rest (dynamic allocation) is still in another "region" (0x7fbf1d40).â Jabberwocky
1 hour ago