Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions getPIDs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

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);
}