Which processes are checked in the line if (pid > 0)?

I have an assignment: create N processes, if one is completed - create a new one There is a code:

pid_t pid; 
pid_t pid1;
pid1 = getpid();

for (int i=0; i<N; i++)
{
    if (pid1 == pid)
    {
        pid = fork();
    }   
}

while(1)
{
    if (pid > 0)
    {
        wait(0);
        pid = fork();
    }
}

Which processes (for example 0..N) are checked in the line if (pid > 0)?