0

What is the difference between below function prototype declarations?

int a(double = 0, double = 10); int a(double j = 0, double a = 10); 
8
  • 3
    There's technically no difference. Commented Aug 8, 2019 at 11:00
  • 1
    In your last edit, you introduced a syntax error: I doubt that void f(double = 0, double = 5, int ) will compile without complaints. (Last parameter without default!) Commented Aug 8, 2019 at 11:09
  • 1
    @Alex Stacy This declaration void f(double = 0, double = 5, int) is invalid. Commented Aug 8, 2019 at 11:10
  • 3
    Don't change the original question into another one completely different. It makes the already given answers obsolete. Writing "read the question again" is not sufficient. Commented Aug 8, 2019 at 11:11
  • 1
    For the records: void f(int x, int y); and void f(double, double, int)... are unrelated. Read about polymorphism -> Overloading concerning this. Commented Aug 8, 2019 at 11:12

1 Answer 1

6

These are both function declarations. Parameter names in function declarations are purely for documentation. So there is no technical difference.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.