Why does my child process not exit?

Im sure it has something to do with the wait() call, but everything ive tried either leaves me with a zombie or with the exec executing indefinitely.

switch(pid = fork())
{
case -1:perror("fork failed");
exit(1);

case 0: 
if(key == "cd")
    {
        
        execl("/bin/cd", "cd", data, (char *)0);
                
    }
    else{
        execl("/bin/sh", key, data, (char *)0);
        perror("exec failed");
        exit(status);    
        }
        
            
default:     waitpid (pid, &status, 0); 
             printf("Done: \n");
        exit(0);
         
}

Have you get any warnings/errors while compiling the code?
Use the strcmp function to compare strings instead of:

if(key == "cd")

no I get no errors, the code runs fine and does what I want. It just doesnt exit the child process.

---------- Post updated at 03:49 PM ---------- Previous update was at 11:52 AM ----------

alright I got it. thanks for the suggestion.