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 split up a string into whitespace-separated fields?
What is the purpose of ftell?
How do you define CONSTANT in C?
Explain heap and queue.
What are derived data types in c?
Differentiate fundamental data types and derived data types in C.
Explain spaghetti programming?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the use of parallelize in spark?
What is define directive?
What is the purpose of 'register' keyword?
What are the applications of c language?
What is the basic structure of c?
Was 2000 a leap year?
Write a program to generate the Fibinocci Series