Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  1
Language: C/C++
Code:
#include<unistd.h>
#include<stdio.h> 
#include<sys/types.h>
int main(int argc, char **argv) {    int  n=0;


    pid_t pid = vfork(); //create child process

    if (pid==0)//if child process
    {
        printf("Child process startedn");
       scanf("%d",&n);

        n = sqrt(n);//calculate square root

       _exit(23);
    }
    else//parent process
    {
     printf("Returnning to parent processn");
    printf("Square Root: %ld",n);
    }

    return 0; }
          
          
          
Comments: