C : Memory layout of C program execution

Posted by pavun_cool on Stack Overflow See other posts from Stack Overflow or by pavun_cool
Published on 2010-03-20T07:04:35Z Indexed on 2010/03/20 7:11 UTC
Read the original article Hit count: 198

Filed under:

Hi All ,

I wanted know how the kernel is providing memory for simple C program .

For example :

#include<stdio.h> 
#include<malloc.h> 
int my_global = 10 ; 
main() 
{ 
char *str ; 
static int val ; 
str = ( char *) malloc ( 100 ) ; 
scanf  ( "%s" , str ) ;
printf( " val:%s\n",str ) ;
}

See, In this program I have used static , global and malloc for allocating dynamic memory So , how the memory lay out will be ... ? Any one give me url , which will have have details information about this process..

© Stack Overflow or respective owner

Related posts about c