answersLogoWhite

0

Need for predefine function

Updated: 11/1/2022
User Avatar

Wiki User

8y ago

Best Answer

In C, all names (including functions) must be declared with a type before they can be used. Knowing a name's type allows the compiler to ensure that operations upon the name are valid for its type, thus preventing many common bugs that might otherwise be missed, such as trying to assign a string to an integer.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Need for predefine function
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you compile program without header file?

Yes,we can compile our program without header file without any error,but we can not use any predefine functions like printf,scanf.


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.


Can you write any c prigramme in c language witthout any function?

No. At minimum, you need to provide a main() function.


What are the three required sets of statements for every function that a programmer writes in C plus plus?

There is no requirement for any statement in a C++ function, let alone three sets of statements. For instance, the following is a perfectly valid function: void foo(){} Clearly this does nothing as it has no statements in the function body, but it is nevertheless a valid function. Perhaps you mean something else by "statements". The only requirement of a function is that it have a return type, a valid name, an argument list and a function body. The return type may be void, of course, and the argument list may be empty, but it must include the ellipses. The function declaration need not include the function body, and the argument list need only specify the type of argument (the argument names are optional and need not match those declared in the actual definition). The function name and the arguments define the function signature (the prototype), thus the three required "components" of a function are the return type, the signature and the function body.


What does a hydroelectric power station need to function?

In order for a hydroelectic power station to function, the station will need a large supply of water. The station will also require large generators with turbines in order to create power from the pressure of the water.