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 manipulate individual bits?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Why can’t constant values be used to define an array’s initial size?
How many levels of pointers have?
How can a process change an environment variable in its caller?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Write a program to find the biggest number of three numbers in c?
What are different types of variables in c?
What is the difference between exit() and _exit() function in c?
What is a structural principle?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
what is the significance of static storage class specifier?
What are the string functions? List some string functions available in c.
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What are structure members?