In short fork function create a child or we can say creates a duplicate process or clone the process, which shares the execution stack. The difference between the parent and the child is the return value of the function. In child process fork() returns 0 and in parent it returns the child pid.
Example
pid_t pid = fork();
if(pid == 0) {
printf("this is a child: my new unique pid is %d\n", getpid());
} else {
printf("this is the parent: my pid is %d and I have a child with pid %d \n", getpid(), pid);
}