Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How can I split up a string into whitespace-separated fields?

1003


What is the purpose of ftell?

1031


How do you define CONSTANT in C?

1208


Explain heap and queue.

1007


What are derived data types in c?

1007


Differentiate fundamental data types and derived data types in C.

983


Explain spaghetti programming?

1187


Explain how can a program be made to print the name of a source file where an error occurs?

1133


What is the use of parallelize in spark?

974


What is define directive?

1073


What is the purpose of 'register' keyword?

1046


What are the applications of c language?

1009


What is the basic structure of c?

1008


Was 2000 a leap year?

1000


Write a program to generate the Fibinocci Series

1154