We can say call-by-reference is where changes in formal parameters are
reflected in actual parameters.
call-by-value is where changes in formal parameters are not reflected in
actual parameters.
However when u have something like

int x=10;
f(&x);

void f(int *p){ *p = 20;}
changes in p(formal parameter) won't be reflected in &x (actual parameter)
However changes in *p are reflected in x, using this the caller's variable
is getting modified by the callee.


Regards,
Sandeep Jain



On Thu, Aug 4, 2011 at 10:19 AM, Shashank Jain <[email protected]> wrote:

> @sandeep, i dint get what do you mean by simulate here, as in an example
> wud be gud.
>
> Shashank Jain
> Delhi College of Engineering
>
>
>
> On Wed, Aug 3, 2011 at 11:34 PM, Sandeep Jain <[email protected]>wrote:
>
>> I'd say C language is a truly call-by-value language. C++ supports
>> call-by-reference.
>> However in C we can "simulate" call-by-reference using pointers and
>> address-of operator.
>>
>>
>> Regards,
>> Sandeep Jain
>>
>>
>>
>>
>> On Wed, Aug 3, 2011 at 11:27 PM, NITIN SHARMA 
>> <[email protected]>wrote:
>>
>>> As we say in C that we do call by reference but i thk call by
>>> reference is something different like we do through "void pointer" in c
>>> ++ but it should be call by address in C is it so?????
>>>
>>> --
>>> 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