Skip to content

Instantly share code, notes, and snippets.

@markson
Created August 6, 2012 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markson/3269297 to your computer and use it in GitHub Desktop.
Save markson/3269297 to your computer and use it in GitHub Desktop.
Test the getpid() function
#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);
}
@markson
Copy link
Author

markson commented Aug 6, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment