0
Function overloading in c ?
if no then how printf takes two parameters also explain yes. Thank you
8 Antworten
+ 1
C++ does it (C doesn't).
And...this has been asked, e.g.:
https://www.sololearn.com/Discuss/99146/why-would-i-want-to-overload-function
Search SoloLearn for 'overloading' to see many more.
+ 1
i think i need to look into the addition of the _Generic keyword in C11. (supported in GCC since version 4.9).
(Overloading isn't truly "built-in" in the fashion shown in the question, but it's dead easy to implement something that works like that.)
_Generic is a compile-time operator in the same family as sizeof and _Alignof. It is described in standard section 6.5.1.1. It accepts two main parameters: an expression (which will not be evaluated at runtime), and a type/expression association list that looks a bit like a switch block.
0
i gone through that man . Depressingly i need one or two line explanation for that for call interview
0
Shortly, there is no function overloading in C.
0
But you can suggest using C++ :) while GCC is everywhere.
0
But anyway I wish you luck!
0
@Kirk i want to know in context of c not c++