write a C program to print the program itself ?!
Answer Posted / neenu jacob
#include <stdio.h>
main()
{
int pid,ppid;
int q=getpid();
int gid,egid,uid,euid;
int f=fork();
if (f==0)
{
printf("hai\n%d\n%d\n%d",getuid(),geteuid());
}
else
{
pid=getpid();
ppid=getppid();
printf("%d\n%d\n%d\n%d",pid,ppid,q,f);
}
system("cat /home/mec/lab1.c");
}
| Is This Answer Correct ? | 0 Yes | 3 No |
Post New Answer View All Answers
How can I open files mentioned on the command line, and parse option flags?
What is const keyword in c?
What are the differences between Structures and Arrays?
What is memcpy() function?
What is array in C
What are the rules for the identifier?
Explain what does a function declared as pascal do differently?
Why do we need volatile in c?
What is line in c preprocessor?
What is union and structure?
What is self-referential structure in c programming?
What are the types of c language?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
to find the closest pair
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?