Read this documentation
http://pubs.opengroup.org/onlinepubs/7908799/xsh/vfork.html

vfork creates read-only copy of the parent. You cannot call function or
assign value to variable except pid_t. Use fork and it should succeed.

PS: Please ask questions related to Algorithms, as it is algorithm group.
You could get fast answers for this type of question on a relevant group. No
offense, it is just a advice. It could save time for other people and YOU
too.

-
Azhar.

On Wed, Sep 21, 2011 at 6:23 PM, sukran dhawan <[email protected]>wrote:

>  @sreeu :lol #include<stdio.h? :P include this header file:P
> That s not saurabh s question
>
> On Wed, Sep 21, 2011 at 4:51 PM, SREENU NAIK 
> <[email protected]>wrote:
>
>>
>> hi it gives that
>>
>>
>> in fun1:incompatible implicit declaration of built-in function ‘printf’
>>
>>  in fun2:incompatible implicit declaration of built-in function ‘printf’
>>
>>
>> On Wed, Sep 21, 2011 at 7:37 AM, saurabh singh <[email protected]>wrote:
>>
>>> #include<sys/types.h>
>>> int fun1()
>>>         {
>>>         if(vfork()==0);
>>>         else printf("Fun1\n");
>>>         }
>>> int fun2()
>>>         {
>>>         printf("Fun2\n");
>>>         }
>>> int main()
>>>         {
>>>         fun1();
>>>         fun2();
>>>         return 0;
>>> }
>>> Why does this program giving seg fault.?
>>>
>>> --
>>> Saurabh Singh
>>> B.Tech (Computer Science)
>>> MNNIT ALLAHABAD
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to