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
Post a Comment