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 is static memory allocation? Explain

851


Can main () be called recursively?

908


What is character constants?

929


What is a const pointer?

837


Explain how do you print only part of a string?

963


Explain Basic concepts of C language?

851


Write a program to print all permutations of a given string.

964


What are the restrictions of a modulus operator?

898


Can we add pointers together?

852


What are the various types of control structures in programming?

847


What is 1f in c?

2336


shorting algorithmS

2051


Explain bit masking in c?

939


Why shouldn’t I start variable names with underscores?

876


What is boolean in c?

851