[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] C Programming problem




On 4 Nov 1999, Vimal Mathew wrote:

> -
> main()
> {
>       int i;
> 
>       printf("Should appear only once");
>       for (i = 0; i<10 ;i++) fork();

Hi,

i have a doubt regarding fork(). Even if i modify the value of 'i'
(or any variable declared in parent) in the child and
if i try to print the address of 'i' ,
both child and parent shows the same address. Why is that.
Is it because both parent and child uses same virtual address space.
If so how it can correctly access the addressed variable(whether child
or parent)

Please clarify 

sudheer


--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.