Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

fork()


#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
  
void forkexample()
{
    int x = 1;
  
    if (fork() == 0)
        printf("Child has x = %d
", ++x);
    else
        printf("Parent has x = %d
", --x);
}
int main()
{
    forkexample();
    return 0;
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
1+1 =