top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between Formal Parameter and Default Arguments?

+1 vote
355 views
What is the difference between Formal Parameter and Default Arguments?
posted Jul 28, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Argument is often used in the sense of "actual argument" vs. "formal parameter".



The formal parameter is what's given in the function declaration/definition/prototype, the actual argument is what's passed when calling the function, an instance of a formal parameter, if you will.

That being said, they're often used interchangably, or depending on language/community, and I've also heard "actual parameter" &c.

So here, x and y would be formal parameters:

return_type fun_name(type x, type y) {
...
}
Whereas here, in the function call, 5 and z are the actual arguments:

fun_name(5, z);

answer Jul 29, 2017 by Ajay Kumar
Similar Questions
0 votes

I have seen at many places that object is passed as reference and as constant reference.
I want to know the usage of each one.

+1 vote

I know that list is used in C++ as we use linked list in C lang. Now, I want to know when forward list is used ?

...