进程
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
pid_t pid; // 每个进程都会有一个非负整数的pid
pid = getpid(); //pid获取
printf("pid:%d\n",pid);
while(1);
return 0;
}
运行结果:
进程
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
pid_t pid; // 每个进程都会有一个非负整数的pid
pid = getpid(); //pid获取
printf("pid:%d\n",pid);
while(1);
return 0;
}
运行结果: