c - Is there any difference between the size of memory allocated for the following types of declaration: -


i) static int a, b, c;

ii) int a; int b; int c;

i not sure how memory allocated these types of declaration. , if these declarations different how memory allocated each declaration?

static int a,b,c; 

will allocate 3 ints (probably 32bits each, or 4 bytes) in data section of program. there long program runs.

int a; int b; int c; 

will allocate 3 ints on stack. gone when go out of scope.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -