What is difference between function declaration and definition in c programming language

Showing Answers 1 - 3 of 3 Answers

baseersd

  • Jul 24th, 2007
 

Function Declaration means telling the compiler what are the types of arguments that are passed toa function , what type of data type it will return. It is ended with a semicolon (;).

Eg :
int add(int , int);
int add(int a, int b);

Definition of a function is the original logic that is written.What to do with the parameters passed and what has to be returned.

Eg :
int add(int a, int b)
{
     int c;
    c = a + b;
    return c;
}

Note: Here there is no semicolon for definition.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions