Computer Science, asked by vaisakhpv033, 8 months ago

What is the problem in the following C declaration?

int func(int);
double func(int);
int func(float);
1.A function with same name cannot have different return types

2.A function with same name cannot have different type of parameters

3.All of the above

4.None of the above

Answers

Answered by mahekabidasyed
3

Answer:

2 function with same name canonit have different tyep of paremeters

Answered by syed2020ashaels
0

Answer:

A function with same name cannot have different type of parameters

Explanation:

For the general situation in C, the solution is straightforward: No. It is simply not possible to have two distinct functions with the same name visible in the same scope.

But as long as they all have internal linkage and are in different translation units, you can have as many functions as you want with any function signatures you want that all have the same name. In any given scope, only one can be seen at once.

Additionally, starting with C11, the Generic selection feature enables the creation of macros that, under some circumstances, can create the appearance of overloaded functions. It falls between between explicitly tailored templates and that (in reality).

We cannot have two functions in one class with the same name and parameter list as the compilers cannot distinguish between these two functions , as such these functions are not allowed. Following are two example code in C++ and other in Java while compiling we get similar error message.

See more;

https://brainly.in/question/50997227

#SPJ3

Similar questions