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
Can two or more operators such as and be combined in a single line of program code?
Differentiate call by value and call by reference?
What is the difference between formatted&unformatted i/o functions?
What are control structures? What are the different types?
Why do we write return 0 in c?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What are the properties of union in c?
Why is void main used?
What does s c mean on snapchat?
How can you invoke another program from within a C program?
Describe newline escape sequence with a sample program?
Explain how can you restore a redirected standard stream?
Explain why C language is procedural?
How do you define a string?
regarding pointers concept