5

Does printf function in c calls argument by reference or by value?

3 Answers 3

12

Everything in C is passed by value.

Even things that look like they're passed by reference (i.e., pointers to variables so that you can change the underlying variables) are in fact the values of the pointers being passed by value.

Sign up to request clarification or add additional context in comments.

2 Comments

hi paxdiablo, let us consider we are passing the variable argument to a function in C++ then will they be passed by value or reference?
@Umesha, C++ has proper reference types, I believe. C doesn't have them. If you're talking about passing from C to C++, you're still limited by C's idioms unless you rely on extensions to the language. C itself (as in ISO C) does not cover inter-language stuff.
3

There's no pass by reference in C, everything is by value or pointer-to-address by value

Comments

0

call by reference is not applicable in c. As in c we can't create alias of any variable,so eiher call by value or call by pointer mechanism is supported here..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.