Why am I getting a warning when I try to wait for the child process to finish (line 24)
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>


int main(int argc, char **argv) {
    if (argc != 2) {
        fprintf(stderr, "Usage: forkloop <iterations>\n");
        exit(1);
    }

    int iterations = strtol(argv[1], NULL, 10);
    int pid = getpid();

    for (int i = 0; i < iterations; i++) {
        int n = fork();
        if (n < 0){
            perror("fork");
            exit(1);
        } else if (n == 0){
            printf("ppid = %d, pid = %d, i = %d\n", getppid(), getpid(), i);
            exit(0);
        } else{
            wait(NULL);
        }
    }

    if (getpid() == pid){
        printf("ppid = %d, pid = %d, i = %d\n", getppid(), getpid(), iterations);
    }

    return 0;
}