Discussion
The output of the code below is
void m(int k)
{
printf("hi");
}
void m(double k)
{
printf("hello");
}
void main()
{
m(3);
}
Answer: C
Correct answer: Compile time error
C has no function overloading: two functions cannot share a name, whatever their parameters. The compiler reports a redefinition. In C++ this would compile, and m(3) would select the int version.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development