Consider the following C program segment. Assume that all the relevant header files are added in the program. What is the output of the program

Computer Organization and Software Systems

Consider the following C program segment. Assume that all the relevant header files are added in the program. What is the output of the program?

main() {
	int childpid;
	childpid=fork();
	if (childpid) {
		printf("Hello");
	}else
	printf("World");
	exit (0);
}

Ans: It will print “Hello” and “World” but can’t say about the order.

Author: user

Leave a Reply