answersLogoWhite

0


Best Answer

A function call is a function that is called from within another function.

Functions must be declared before they can be called, in order to establish the function's prototype (signature) so the compiler knows which function to call.

The function definition contains the implementation of the function and may be specified in the declaration itself (inline), or it can be defined in another file altogether.

Declarations are typically placed in a header file so that they may be included (#include) in any files that require them, including the file containing the definition of the function declared in the header file. Including a file is the same as typing the file contents in full at the point of inclusion, thus ensure the declarations are available to the compiler before they are used.

The following example shows a forward declaration of a function that is defined later.

// forward declaration.

int square(int);

// the main function (the entry point of application).

int main()

{

// a function call.

int s = square( 5 );

// returns the value 25 to the calling process (e.g., the operating system).

return( s ); }

// definition of the function declared earlier.

int square(int data)

{

// returns the square of the data to the calling function, e.g., main().

return( data * data );

}

Function is a self contained block or a sub program of one or more statements that performs a special task when called.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What you meant by function call function definition and the function declaration in c and c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Does a function call come before main?

It does not have to. What is necessary, is that a function be declared before using it, so you either need function declaration separately from definition, or you need to arrange the declaration/definition in the right order, which usually places the main() function last.


What is difference function prototype and function define in turbo c?

In C, a function prototype is a declaration to the compiler that a certain function exists, without a full definition. This allows other functions to call that function. The linker will later make sure that a function definition actually exists (perhaps somewhere else), and will turn the call to the function to a call to the correct function.


What is meant by arguments in c?

Arguments appear in functions and in function calls. Arguments passed to a function are known as actual arguments. The arguments used by the function are known as the formal arguments. In C, all arguments are passed by value, such that the formal argument is a copy of the actual argument.


Can you call predefined function recursively?

Guess you meant: can a recursive function call predefined functions? Answer: sure, why not.


What is the difference between function declaration and function definition?

// function declaration void functionName (int, double); // function definition void functionName (int x, double y) { // implementation... } A function declaration informs the compiler of the function's type, its name and the number and type of its arguments. A declaration is required so the compiler knows what the name represents and how it may be used, but it is not necessary to know what it does or how it does what it does. A definition is also a declaration, but also includes the names of its formal arguments and provides the implementation details of the function itself. A declaration without a definition is not required, however declarations do help programmers to see the interface without being distracted by the implementation details. By placing declarations in a header file, multiple translation units can make use of the same declaration regardless of which translation unit defines the implementation. This also makes it possible to create functions that depend on each other because it would be impossible to define a function that used another function that hadn't yet been declared.

Related questions

Does a function call come before main?

It does not have to. What is necessary, is that a function be declared before using it, so you either need function declaration separately from definition, or you need to arrange the declaration/definition in the right order, which usually places the main() function last.


What is difference function prototype and function define in turbo c?

In C, a function prototype is a declaration to the compiler that a certain function exists, without a full definition. This allows other functions to call that function. The linker will later make sure that a function definition actually exists (perhaps somewhere else), and will turn the call to the function to a call to the correct function.


What is meant by arguments in c?

Arguments appear in functions and in function calls. Arguments passed to a function are known as actual arguments. The arguments used by the function are known as the formal arguments. In C, all arguments are passed by value, such that the formal argument is a copy of the actual argument.


What is meant by a function call?

A function call is where you "call" a function and execute its body. For example: void example() { } int main() { example(); // call the function "example" and execute its bodyreturn 0; }


Can you call predefined function recursively?

Guess you meant: can a recursive function call predefined functions? Answer: sure, why not.


Call by function in c language?

I guess you meant the following:'In C language, when you call a function,the parameters are passed by-value.'


What is the difference between declaring variable and initializing variables?

Actually, there is a third step, call definition. Declaration is a statement to the compiler of what type an identifier is, definition is the allocation of memory for that identifier, and initialization is the assignment of an initial value to that identifier. Usually, declaration and definition are done together, but you can also add initialization in that step if desired. int a; /* declaration and definition */ a = 1; /* initialization */ int a = 1; /* declaration, definition, and initialization */ For the case of seperate declaration and definition, consider the struct... struct _mystruct { int a; }; /*declaration */ struct _mystruct mystruct; /* definition */ struct _mystruct { int a; } mystruct; /*declaration and definition */ Note: To be more precise: struct _mystruct; /* struct declaration */ struct _mystruct { int a; }; /* struct definition */ typedef struct _mystruct MYTYPE; /* type definition */ extern struct _mystruct mystructvar; /* variable declaration */ struct _mystruct mystructvar; /* variable definition */ struct _mystruct mystructvar = {7} ; /* variable definition with initialization */ struct _mystruct { int a; } mystruct; /* struct definition and variable definition */ extern struct _mystruct { int a; } mystruct; /* struct definition and variable declaration */


What is meant by a system call in operating system?

A "System call" you be a function accessible from a programming language to the base hardware of the computer (eg to get the time).


What is the difference between function declaration and function definition?

// function declaration void functionName (int, double); // function definition void functionName (int x, double y) { // implementation... } A function declaration informs the compiler of the function's type, its name and the number and type of its arguments. A declaration is required so the compiler knows what the name represents and how it may be used, but it is not necessary to know what it does or how it does what it does. A definition is also a declaration, but also includes the names of its formal arguments and provides the implementation details of the function itself. A declaration without a definition is not required, however declarations do help programmers to see the interface without being distracted by the implementation details. By placing declarations in a header file, multiple translation units can make use of the same declaration regardless of which translation unit defines the implementation. This also makes it possible to create functions that depend on each other because it would be impossible to define a function that used another function that hadn't yet been declared.


How function can be nested in c?

A function can call other functions (or itself), but a function-definition cannot be nested in another function-definition: int main (void) { void wont_compile (void) { puts ("Won't compile"); } wont_compile (); return 0; }


10 example of a predefined function in a c?

1. Cat2. Cake3. Closet4. Coffin5. Cuckoon6. Cukoo Clock7. Clock8. Case9. Card10. ClothesThere we go, then things starting with C, if that is what you were asking for, but if its not, i would make your question more understandable, maybe change some words.Bye x


How is a procedure identified as near or far?

The far procedure is used at the place where the function call is given in main program and function definition is given in sub program....