Why isn't the execlp() function doing anything?

This is a discussion on Why isn't the execlp() function doing anything? within the C Programming forums, part of the General Programming Boards category; I'm having issues finding this information without the use of a forum, so here goes:
I'm making a very basic ...

Why isn't the execlp() function doing anything?

I'm having issues finding this information without the use of a forum, so here goes:

I'm making a very basic program on Linux that spawns four child processes. Each child process runs a separate program in the same directory, in which it just keeps printing its ID out to the screen over and over again. After the parent process spawns these, it just does the same thing until about 20 seconds have passed since the program started, at which point it kills all processes and terminates.

The code for the two programs is this:

Parent Process Program:

Code:

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <signal.h>
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
/********************************************************************************
* Method: void newProcesses() *
* Purpose: to make four child processes, each of which will execute a certain *
* program in the same directory *
* Returns: N/A *
* *
* Approach: This method first creates an array for four separate process ID's. *
* Then it goes through a four-iteration for loop, with each iter- *
* ation involving the creation of a child process. Each time a *
* process is supposedly created, the loop checks to see if the *
* creation was successful. If not an error message is printed. *
* If so, and if it is the child process that is currently execut- *
* ing, then the child process is made to execute a program in the *
* same path as this program, the former being called "Subprogram".*
* Otherwise it is the parent process that is currently executing, *
* so the for loop will just use the parent to print a message of *
* successful creation, including the child process's ID. *
********************************************************************************/
void newProcesses()
{
/* method for making new processes */
int id[4]; /* process ID array */
int i; /* for loop iterator */
for (i = 0; i < 4; i++)
{
id[i] = fork();
if (id[i] == -1) /* an error occurred */
{
printf("Creation of Child Process failed.\n");
}
else if (id[i] == 0) /* this is the child process currently acting */
{
execlp("/jroberts/Subprogram", "/jroberts/Subprogram");
}
else /* this is the parent process currently acting */
{
printf("Creation of Child Process #%d succeeded!\n",id[i]);
}
}
}
/********************************************************************************
* Method: int main() *
* Purpose: to serve as the driving method for the entire program *
* Returns: 0 to the operating system to signal successful termination *
* *
* Approach: First this method finds the current time in seconds and stores it *
* in two different variables, initial and current. Then it gets *
* the current (parent) process's ID and prints a message with *
* that ID out to the screen. Then it calls void newProcesses() *
* to make child processes and handle each of them accordingly. *
* Finally it enters a loop, each iteration of which checks the *
* clock and updates current. After it has been found that 20 *
* seconds have gone by, the loop is ended, all the processes are *
* killed, and the method is basically finished. *
********************************************************************************/
int main ()
{
/* setting up the program's "timer" for the program to know when to kill processes */
time_t initial; // starting time of the program in seconds
time_t current; // current time in seconds
time(&initial); /* initializing both initial and current to the starting time
current = initial; */
/* the master process will give out its ID, subsequently making new processes */
int ownID = getpid();
printf("Parent Process created with ID# %d.\n", ownID);
/* now the child processes will be made. */
newProcesses();
/* at this point there should be child processes. Now the parent process will wait until the
progrm has lasted for about 20 seconds, subsequently killing all processes. */
time(&current);
while(current - initial < 20) // the program has executed for less than 20 seconds
{
printf("Parent Process with #%d currently executing.\n",ownID);
time(&current);
}
kill(0,SIGKILL);
return 0;
}

Alright, I've added NULL at the end of the argument list, but that didn't change anything. Also I accidentally left out of the output section that before mentioning any of the child processes, the parent process does give its ID out once, as per its instructions before newProcesses() is called

I've come to realize the reason that there are an excessive number of child processes is that, even though the child processes are falling into the if statement concerning whether their "id" is 0, they fall right back out of it and continue to iterate through the for loop, despite the execlp function.

Shortly after writing the last paragraph, I played with the code a little more and finally found out what was going wrong with all the other paths or whatever I had tried. I finally got the full path in the correct format (the format was also an issue).