Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:48:03+00:00 2026-06-09T05:48:03+00:00

From now on, I think after fork() is being called, the local variable is

  • 0

From now on, I think after fork() is being called, the local variable is duplicated into parent process and child process, they are separated. But I try to fetch the address of each local variable in different process,it turns out that they are same:

int main(void){
  int local = 10;
  pid_t childPid;
  childPid = fork();
  if(childPid == 0 ){
    printf("[Child] the local value address is %p\n",&local);
  }else if(childPid < 0){
    printf("there is something wrong");
  }else{
    printf("[Parent] the local value address is %p\n",&local);
  }
  return (EXIT_SUCCESS);
}

The output is:

[Parent] the local value address is 0x7fff5277baa8
[Child] the local value address is 0x7fff5277baa8

Any idea about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:48:04+00:00Added an answer on June 9, 2026 at 5:48 am

    Being in a different “space” means that the “same” index point in different spaces does not refer to the same thing. Think of “spaces” as pieces of paper. “The 4th character of the 3rd line” on page 1 does not refer to the same thing as on page 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In docs link about expires # Task expires after one minute from now. add.apply_async(args=[10,
This may be closed, a couple of minutes from now, but I think I
I think I understand why IEnumerable<T> inherit from IEnumerable , after reading the post:
I am having problems pulling a fork from github into a folder, where the
new_thing = MyTable(last_updated=datetime.datetime.now()) new_thing.save() >>>>select * from MyTable\G; last_updated: 2010-04-01 05:26:21 However, in my
The thing im trying to do right now is pulling in multiple links from
Okay weirdest thing is happening I separated my navbar from my container and now
some weeks from now I've been receiving this strange message almost every time I
I have set cache headers to be far in future (1 year from now)
I want to develop a custom input method on iOS platform. From now on,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.