reap zombie process in c

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main() {
    pid_t childPid;

    // Create a child process
    if ((childPid = fork()) == 0) {
        // This code runs in the child process

        // Perform some tasks in the child process

        // Exit the child process
        exit(0);
    } else if (childPid > 0) {
        // This code runs in the parent process

        // Wait for the child process to exit
        waitpid(childPid, NULL, 0);

        // Perform some tasks in the parent process after the child has exited

    } else {
        // Handle fork() error
        perror("fork");
        exit(EXIT_FAILURE);
    }

    // Rest of the program

    return 0;
}