c - Can a child process change a static variable shared by his parent? -


can child process change static int shared parent process? similiar simple example:

static int changeme = 1; ... int main() {    if (fork()=0){       changeme = 0;    }    wait(0);    printf(1, "changeme value is: %d., changeme); } 

i know child creates clone of parent memory. want child change values @ parent - possible?

not through fork, since you're creating new process separate stack , address space. if want share variables, @ using threads.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -