Parent process starts before the child using signal, in C

Hi, i want that the parent process start before the child, this code doesn't work,
if the child start before the parent it wait for signal, then the father send the signal SIGALRM and the child catch it and call printf;
else the father call printf and send the signal to the child that call its printf;
in any case nothing happens:

#include <signal.h>
#include <stdio.h>   
#include <unistd.h> 
#include <signal.h>  

void catch(int);

int main (void) {

pid_t pid;
pid = fork();

if (!pid){                    
    signal(SIGALRM,catch);
    pause();
     
} else{                
       kill(pid,SIGALRM);
       printf("start the father\n");
  }
}

void catch(int signo) {
	printf("start the child");
}

You can�t rely on the order of execution for the parent and child after a fork. You are facing a tipical race condition problem: the parent process is signaling the child before the child can install it�s signal handler. This is why it is not printing the message you expect. To solve this, you need some sort of syncronization. The easiest way to do it in this simple program is to have the parent sleep for a small amount of time so the child will be able to install it�s signal handler before being signaled by the parent.

if (!pid){
    signal(SIGALRM,catch);
    pause();

} else{
       sleep(1); /* let the child have the chance to execute before the parent */
       kill(pid,SIGALRM);
       printf("start the father\n");
  }