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
What tq means in chat?
Explain 'bus error'?
How do you determine a file’s attributes?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Is the exit() function same as the return statement? Explain.
Can a pointer be static?
What is ponter?
Is this program statement valid? INT = 10.50;
What is a protocol in c?
Can we change the value of static variable in c?
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is header file definition?
What is scope rule of function in c?
What are examples of structures?
Write a Program to accept different goods with the number, price and date of purchase and display them