what is the difference between declaration and definition
of a variable or function ?

Answer Posted / suman_kotte

declares a function, but that does not define it.
declaration describes whether the function consist
arguments or not and also it will return a value or not.

definition must be as per the function declaration that was
declared rearlier.it will for the out put of that function.

ex;

main()
{
int a=1,b=2;
void sum(int , int );//declaration
sum(a,b);
}
void sum(int x, int y)//definition
{
printf("%d",x+y);
}

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the uses of null pointers?

588


What is the meaning of c in c language?

592


What is the use of volatile?

603


What does sizeof function do?

609


What is the use of a ‘’ character?

582






What are the keywords in c?

638


Why is structure important for a child?

601


How can I get random integers in a certain range?

609


What is #define size in c?

640


Explain how can I read and write comma-delimited text?

648


what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

1426


What is variable and explain rules to declare variable in c?

548


Why c is called a middle level language?

634


How do you determine a file’s attributes?

598


What math functions are available for integers? For floating point?

616