what is wrong here?
what is wrong here?
Step by step
Solved in 4 steps with 2 images
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Driver code
int main()
{
char name[100];
int PID;
printf("Enter the user name: ");
scanf("%s",name);
PID = fork();
if(PID == 0){
printf("\n%d This is child process %s",PID,name);
}
else{
printf("%d This is parent process %s\n",PID,name);
}
exit(0);
return 0;
} It does let me enter the number of fork but only 1 character can be enter in the username. If I type multiple character to username It does not let me enter the number of fork. I use ubuntu.
The command that I used in ubuntu
>gedit prog.c
(CODE FILE)
>cc -c prog.c
>cc -o prog prog.c
>./prog
Correct me please