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
Explain the difference between structs and unions in c?
What is the best way to comment out a section of code that contains comments?
Why is event driven programming or procedural programming, better within specific scenario?
What does c mean before a date?
What is the need of structure in c?
How many levels of pointers have?
What is f'n in math?
How is = symbol different from == symbol in c programming?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Are bit fields portable?
What is pointer and structure in c?
Do you know the use of 'auto' keyword?
Why is extern used in c?
What do you understand by normalization of pointers?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }