Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <unistd.h>
- void fonction(int n){
- if(n <= 0) printf("MESSAGE D\'ERREUR");
- else{
- pid_t pid;
- pid = fork();
- if( pid == 0) fonction(n-1);
- else
- printf("pid : %d\n", pid);
- }
- }
- int main(int argc, char *argv[]){
- if(atoi(argv[1])>0){
- fonction(atoi(argv[1]));
- return 0;
- }else {
- printf("Erreur");
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement