C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - Yes / No Questions (Q.No. 5)
5.
Is it true that a function may have several declarations, but only one definition?
Yes
No
Answer: Option
Explanation:

Yes, but the function declarations must be identical.

Example:

#include<stdio.h>

void Display();
void Display();
void Display();

void Display()
{
   printf("Weclome to IndiaBIX.com..!");
}

int main()
{
    Display();
    return 0;
}

//Output:
Weclome to IndiaBIX.com..!
Discussion:
12 comments Page 2 of 2.

Divya Reddy said:   4 years ago
Based on return type of functions and the data types of parameters passed through the functions. We can know whether the function declarations are the same or not.

Kannan said:   4 years ago
C doesn't support function overloading (it can only be achieved indirectly using pointers) and thus the answer provided is correct.


Post your comments here:

Your comments will be displayed after verification.