default values

Mar 1, 2016 at 6:25am
Give an example to illustrate the use of default values. Does it make compiling more efficient? Does it make the object code shorter? Why do we use it?
Mar 1, 2016 at 11:18am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void SetValue(const int val = 0);

int main()
{
  SetValue();
  SetValue(123);

  return 0;
}

void SetValue(const int val)
{
  SomeValue = val;
}


Does it make compiling more efficient?
No
Does it make the object code shorter?
See above.
Why do we use it?
As a hint.
Topic archived. No new replies allowed.