0

Why can't a default value be set in c?

5th Apr 2018, 4:36 PM
Otumian Empire
Otumian Empire - avatar
6 Answers
+ 3
5th Apr 2018, 5:16 PM
Ipang
+ 3
The language designers did not consider this feature important as they were designing a low level language close to the machine
5th Apr 2018, 5:25 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
+ 3
@Otumian Empire, Have you read the link in my previous post? in short, there's no easy way for that, the parameter default value was introduced in C++, it was not available in C language (cmiiw).
5th Apr 2018, 5:28 PM
Ipang
+ 1
void func(int x, int y = 1) reads an error
5th Apr 2018, 5:18 PM
Otumian Empire
Otumian Empire - avatar
+ 1
yeah. I did..
5th Apr 2018, 5:35 PM
Otumian Empire
Otumian Empire - avatar
5th Apr 2018, 5:24 PM
Otumian Empire
Otumian Empire - avatar