diff --git a/getPIDs.c b/getPIDs.c new file mode 100644 index 0000000..d9c02bf --- /dev/null +++ b/getPIDs.c @@ -0,0 +1,16 @@ +#include +#include +#include + +void main(){ + pid_t pid; //variable to store process id + pid_t ppid; //variable to store parent process id + + sleep(5); + + pid = getpid(); // returns pid + ppid = getppid(); //returns parent pid + + printf("The process id is : %d\n" , pid); + printf("The parent of process id is : %d\n" , ppid); +}