What is wrong with the following code, there is no result ,just waiting, i do not know why that happens
Code:int main(void) {
int pid, mypipe[2];
if(pipe(mypipe) == -1) {
perror("pipe");
exit(1);
}
pid = fork();
if(pid > 0) {
dup2(mypipe[0],0);
close(mypipe[0]);
execlp("wc","wc",NULL);
perror("exec");
exit(1);
}
if(pid == 0) {
dup2(mypipe[1],1);
close(mypipe[1]);
execlp("ls", "ls", NULL);
perror("exec");
exit(1);
}
return 0;
}