we all know about the function overloading concept used in
C++ and we all learnt abt that.... but that concept is
already came in C in a very smaller propotion ... my
question is IN WHICH CONCEPT THERE IS A USE OF FUNCTION
OVERLOADING IS USED in C language?????????????

Answers were Sorted based on User's Feedback



we all know about the function overloading concept used in C++ and we all learnt abt that.... but t..

Answer / sandeep

Function Overloading or Polymorphic Behaviour for C
functions can be seen for those functions who accept
variable number of arguments.
They can take any number of arguments and any type of
arguments, its upon the programmer or the code inside it,
that decides what it wants those arguments to be , int ,
char ,float or something else..

ALthough it is not seperate function that runs for different
number and types of arguments, still for the user, a
function will be provided for different types of list of
input parameters, all being sent to the same ('name of the
')function..

#include <stdarg.h>
enum data_type{ TYPE_INT=0,TYPE_STRING=1};
int max( int num_of_arguments,...)
{
va_list arg_list;
va_start(arg_list, num_of_arguments);
data_type type=va_arg(arg_list,data_type);

if(type=TYPE_INT)
{
int max =0,i;
for(i = 2; i <= num_of_arguments; i++)
{
if((a = va_arg(arg_list, int)) > max)
max = a;
}
}
else
{
//do whaterver..
}
va_end(arg_list);

}

Is This Answer Correct ?    10 Yes 2 No

we all know about the function overloading concept used in C++ and we all learnt abt that.... but t..

Answer / vaidyanathan

Hi,MY name is vaidyanathan....and and we have used such type of concepts in the recursion..

Is This Answer Correct ?    2 Yes 0 No

we all know about the function overloading concept used in C++ and we all learnt abt that.... but t..

Answer / rohit

Function Overloading or Polymorphic Behaviour for C
functions can be seen for those functions who accept
variable number of arguments.
They can take any number of arguments and any type of
arguments, its upon the programmer or the code inside it,
that decides what it wants those arguments to be , int ,
char ,float or something else..

ALthough it is not seperate function that runs for different
number and types of arguments, still for the user, a
function will be provided for different types of list of
input parameters, all being sent to the same ('name of the
')function..

#include <stdarg.h>
enum data_type{ TYPE_INT=0,TYPE_STRING=1};
int max( int num_of_arguments,...)
{
va_list arg_list;
va_start(arg_list, num_of_arguments);
data_type type=va_arg(arg_list,data_type);

if(type=TYPE_INT)
{
int max =0,i;
for(i = 2; i <= num_of_arguments; i++)
{
if((a = va_arg(arg_list, int)) > max)
max = a;
}
}
else
{
//do whaterver..
}
va_end(arg_list);

}

In c we are not allowed to function overloading with
parameters wherever we like.

Is This Answer Correct ?    0 Yes 1 No

we all know about the function overloading concept used in C++ and we all learnt abt that.... but t..

Answer / venkatesh

In c also we are allowed to function overloading with
parameters wherever we like.

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More C Interview Questions

What is array of structure in c?

0 Answers  


Define the scope of static variables.

0 Answers  


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

0 Answers   TATA, TCS,


What is the difference between %d and %*d in C

3 Answers  


what is the difference between <stdio.h> and "stdio.h"

14 Answers   Invendis, Kanbay, Mastek, MathWorks,






Write a c program using for loop in switch case?

1 Answers   Infosys,


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


What is the code for 3 questions and answer check in VisualBasic.Net?

0 Answers   Infosys,


How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

2 Answers  


in which language c language is written?

2 Answers  


how to write palindrome program?

3 Answers  


44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?

6 Answers   Amdocs,


Categories