This program works with out any error. here fork is not a system call. It just act as a variable.But how it works without declaring it? What data type it is?
Please help me to get a solution. I have tried all . But i cant come out with an answer.
it will work. but I didn't declare the ss in this file.
how it's work? did you understand this example with your code.
the fork variable is declared in #include<unistd.h> file. so it's not showing the error.
if you are using vim. editor then place the cursor on the "#include<unistd.h> " and hit gf then the "unistd.h" file will open. then search the variable fork.
But i dint find any declared variable like fork in unistd.h. In your example i can tell ss is an integer type by seeing the include header file..but here can you tell wat datatype fork is? And in a declared variable i can do ++ or -- operation. but here its not working.
fork in this case is not a variable. It's a pointer of type void to the entry address of the fork() function in the C library. Basically, you could "rename" the fork call by doing
__pid_t (*foo)() = fork;
and later calling foo instead of fork.
Also, if you'd have compiled with warnings enabled, or read them, you'd have seen something like this:
If i have less programming sense,what to call the people who has replied to my post?.Learn how to behave in a public forum.Respect others.It just to help the people:)