37 lines
481 B
C
37 lines
481 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
|
|
long int fibo (long int n)
|
|
{
|
|
if (n <= 1)
|
|
return n;
|
|
long int pipe[2];
|
|
pid_t proc;
|
|
assert (pipe(pipe) >= 0);
|
|
proc = fork();
|
|
assert(proc != -1);
|
|
switch(p){
|
|
case 0:
|
|
break;
|
|
default:
|
|
/*code*/
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
long int n;
|
|
assert(argc > 1);
|
|
n=strtol(argv[1],NULL,0);
|
|
printf("fibo(%ld) = %ld\n",n,fibo(n));
|
|
return 0;
|
|
}
|
|
|