Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> In classic C or C++, you would define a function taking optional arguments as :

Is that true? Can classic C have default (optional) arguments?



  void fun(int mandatory_arg, int optional_arg1 = 1, int optional_arg2 = 12, int optional_arg3 = 12);
No, this isn't legal ISO C. There are ways to simulate them though: https://gustedt.wordpress.com/2010/06/03/default-arguments-f...


My mistake, I just fixed the readme.


No, classic C doesn't have default arguments.


That's what I thought.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: