0

I know that when a class has multiple functions with the same name and different parameter list it is called function overloading.

But in case of printf() function, whenever we want to print values of different data types by using format specifiers like this as given below

printf("%c%d%f",a,b,c);  

can we say it is function overloading?

Prashant Mishra
  • 167
  • 1
  • 9
  • 1
    C does not have function overloading. I think you are asking about variable arguments. http://stackoverflow.com/questions/2351792/does-c-support-overloading – Weather Vane May 07 '15 at 20:06
  • How printf handles arguments : http://stackoverflow.com/questions/2433295/how-does-printf-handle-its-arguments. Its a variadic function. – Prabhu May 07 '15 at 20:07

2 Answers2

1

No. Its not function overloading. C doesn't support overloading. printf is variadic function which accepts a variable number of arguments.

haccks
  • 104,019
  • 25
  • 176
  • 264
1

There is no mechanism of function overloading in C.

With function overloading, you have different functions with the same name but with different signatures. printf is a variadic function (it accepts a variable number of arguments) and it has a single signature:

int printf(const char * restrict format, ...);
ouah
  • 142,963
  • 15
  • 272
  • 331