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

application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

845


How do you generate random numbers in C?

931


Difference between Function to pointer and pointer to function

849


What does c mean before a date?

855


Why are all header files not declared in every c program?

830


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4419


What are the 5 types of inheritance in c ++?

780


How many levels of indirection in pointers can you have in a single declaration?

847


Does c have enums?

795


What is a class c rental property?

866


How do I round numbers?

790


Write a c program to demonstrate character and string constants?

1926


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

925


What is mean by data types in c?

768


What are the general description for loop statement and available loop types in c?

911