answersLogoWhite

0


Best Answer

In C Programming, there are no built-in functions; all functions are user-defined. In order to use a function it must first be declared. This can be achieved by importing the header file containing the declaration (via the #include compiler directive) or by typing the declaration by hand.

The definition (implementation) of a function is not required in order to use a function, but if a function is used it has to be defined somewhere (undefined functions will cause a link error). Where a function is used by several translation units, placing the declaration in a header file ensures the declaration is consistent across all translation units. Grouping declarations by purpose allows us to import several declarations at once. Declarations that are not used are simply ignored.

A declaration informs the compiler of the function's name and type, and the number and type of its arguments, if any. This describes the interface to the function. A function's type is denoted by its return type. A function that has no return value is simply declared void (no type). The return type always comes first in a declaration, followed by the function name, which must be a unique identifier within the scope in which it is declared (global or local scope). A local name will mask a global name, effectively hiding it from the local scope.

Function arguments (the formal arguments of the function) are delimited by parenthesis after the function name. A single argument of type void denotes no arguments while multiple argument types must be separated by commas (void types are not permitted in a multiple argument function). The complete declaration is terminated by a semi-colon immediately after the closing parenthesis. If the declaration is also a definition, the function body (the implementation) replaces the closing semi-colon.

To assist with documentation, the formal arguments of a declaration may be named (unless the argument is void). However, where names are given, they need not match the corresponding names provided by a function's definition, where defined separately. Using longer descriptive names in the declaration helps document their purpose, while the definition can use shorter names that are easier to work with.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What will be the prototype of a user defined function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is prototype in C language?

A prototype in C is the declaration of a function. Without a prototype, the function cannot be called because the compiler would have no way of knowing if the function was being called correctly. Prototypes may appear in multiple translation units but can only be defined once. A definition is itself a prototype.


Can a C plus plus user defined function return a value?

Absolutely. Indeed, any function (user-defined or built-in) that does not return a value is not really a function, it is simply a procedure.


To create a user defined sizeof function?

Not possible.


How do you reverse a string with out using strrev?

By writing user defined function.


How switch function differs from user defined functions in C?

. please give me 3 or 4 differences.one difference is that user defined can be called anytime but not for switch There is no such thing as 'switch function'


What is the difference between pre-defined formulas and user-generated formulas?

Pre-defined comes built in as a function. [=SUM(A1:A12] User-generated is created by the user. [=A1+A2]


Is main a predefined function in java?

No. It is a user defined function which the person who is creating the java class has to code by himself.


Is the main function in C a built-in function or user-defined function?

The main function in C is user-defined. Built-in functions are simply those that do not require a library to be included, but every program must provide a user-defined point of entry; it cannot be built-in. Indeed, most functions in C are user-defined; the built-in functions are mostly operators rather than functions although most do behave like functions. The standard library functions are not built-in either; they all require the inclusion of the appropriate standard library header.


How do you create function in php?

they're called user-defined functions, this is the syntax: function the_user_defined_name() { the code you want here }


Which characters cannot be used in user-defined names in C?

The space and punctuation characters cannot be used in user-defined names. Only letters, digits and the underscore character are permitted, but a user-defined name cannot begin with a digit. User-defined names include function names, type definitions, enumerations, variables and constants.


When can a function prototype be omitted?

when we write definition of a function i.e; body of a function above main() function, then the function prototype be omitted. -Ramashankar Nayak,M.C.A,Pondicherry University


What is the difference built in functions and user defined functions?

There are two types of functions in C++: Built-in or standard Library Function User defined function BUILT-IN FUNTION Built-in function which are also called Standard Library Functions are the functions provided by the C++ and we do not have to write them. These functions are included in the Header Files They are mostly written at the start of the Program They cannot be changed. EXAMPLE: conio.h; clrscrn; , etc. USER-DEFINED FUNCTION A user-defined function is a function defined by the programmer. It allows the programmer to write their own function. It allows the programmer to divide the program in many parts, which makes it easy for the programmer to rectify or modify the program; as it is easy to locate & jump to any part of the program. A programmer can write groups code to perform a specific task and that group of code is given a name (identifier).