public
Created

Test the getpid() function

  • Download Gist
getpid.c
C
1 2 3 4 5 6 7 8
#include <stdio.h>
#include <sys/types.h>
 
int main(void){
pid_t this_process;
this_process = getpid();
printf("this process value is %d and hex value if 0x%x\n", this_process,this_process);
}

it gives me a warning:

getpid.c:6:17: warning: implicit declaration of function 'getpid' is invalid in
C99 [-Wimplicit-function-declaration]
this_process = getpid();
^
1 warning generated.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.