0 like 0 dislike
27 views
in Computer Science by (1.0m points)
Describe the function prototype and function call in detail.

1 Answer

0 like 0 dislike
by (1.0m points)
A declaration is code that declares an identifier and its type. A function declaration is a declaration of a function. In other words a function declaration declares the name of the function and the type of what it returns. You must declare an identifier before you can use it.

A function prototype is a declaration of a function that declares the types of the function’s parameters. These days, that’s most, if not all of them. In early versions of C, you were allowed (required) to declare a function with empty parentheses, even if the function required one or more parameters. If you did this, it was up to the programmer (you) to ensure the function was called properly, with the correct number of parameters each having the correct type. Since the C90 standard, there has been no reason to do so in new code. If the function is called in the presence of a prototype, the compiler checks to ensure the parameters are correct. The ability to declare functions the older way has been retained to support legacy code.

A function definition defines the function itself. It also acts as a declaration, and if the declaration includes the types of its parameters, a prototype as well.

Related questions

0 like 0 dislike
1 answer 52 views
asked Feb 13, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 42 views
0 like 0 dislike
1 answer 25 views
0 like 0 dislike
1 answer 33 views
0 like 0 dislike
0 answers 40 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 16 views
0 like 0 dislike
1 answer 55 views
asked Apr 2, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 73 views
asked Feb 9, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 29 views
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.3k users

Free Hit Counters
...