How to function overload in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to function overload in C

How function overloading in c easy explain plz

11th Mar 2021, 12:20 PM
Ashish_Gupta
Ashish_Gupta - avatar
2 Answers
+ 1
Function overloading is a C++ feature. In C functions are distinguished by their identifier alone (not the number of parameters or the type of those parameters). There are ways around it (see: _Generic in C11) but the simplest and most portable solution is to add the name of the type at the end of the function identifier (as is done in the C standard library and many 3rd party libraries, ex: strtol, strtoul, strtof, strtod, atoi, atof, atol, etc).
11th Mar 2021, 1:13 PM
Mike A
Mike A - avatar
0
By providing different number of arguments to functions with same name. They are many examples online that you can go through to get a detailed explanation on it.
11th Mar 2021, 12:22 PM
Abhay
Abhay - avatar