I did not compile and run the program but I think the problem is indicated by the output. What is the output? From the code ist should be:
Parent started: child forked...
Parent started: Child has stopped.
The 'Parent started' indication of the second line is wrong. This is printed by the child. To fix this, remove the first printf() and prepend the started string to the fork messages. Optionally add a printf("Child has the started") before calling
childfunc()
.