I have to write a C program that creates 10 child processes, which each write a message when created. Also the Parent should print a message when one of the Childs terminates.
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
void CHLDhandler(int);
int main(int argc, char const *argv[]){
  pid_t p;
  signal(SIGCHLD,&CHLDhandler);
  for(int i=0; i < 10; i++){
    p = fork();
    if ( p == (pid_t) 0 ) {
      /* child */
      signal(SIGCHLD, SIG_IGN);
      printf("Child number %d was born!\n",i);
      return 0;
    }
    else if ( p > (pid_t) 0 ) {
      /* parent */
    }
  }
}
void CHLDhandler(int sig){
  printf("Child finished\n");
}
This is my code so far. On Linux it runs fine but on MacOS I get an Illegal Hardware Instruction Error.Error Message
