Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Language%20in%20C%20Interview%20Questions%20and%20Answers

Question: Can we get the process identification number of the current program?

Answer: Yes! The macro getpid( ) gives us the process identification number of the program currently running. The process id. uniquely identifies a program. Under DOS, the getpid( ) returns the Program Segment Prefix as the process id. Following program illustrates the use of this macro.
#include <stdio.h>
#include <process.h>

void main( )
{
printf ( "The process identification number of this program is %Xn",
getpid( ) ) ;
}

Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook