top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between function signature and function prototype?

+1 vote
5,593 views
What is the difference between function signature and function prototype?
posted Jun 22, 2014 by Neelam

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

A function prototype is a definition the which is structured in the same way as a normal function is structured, but in instead of containing code, prototype ends in a semicolon. Function prototypes is a C or C++ concept and not relevant to Java.

In c++ we have a concept of function signature which consists of the function prototype. It tells you is the general information about a function, its name, parameters, what scope it is in, and other miscellaneous information.
Example :
static const int & MyClass::MyFunc(int a, int b);

In Java we have a concept of method signature which consists only of the name of the method and the parameter types and their order.

answer Jun 22, 2014 by Tapesh Kulkarni
0 votes

A method signature consists only of the name of the method and the parameter types and their order. The modifiers, return type and throws clause are not part of the signature .

Function prototypes are a C concept that is not relevant to Java.

A function prototype is basically a definition for a function. It is structured in the same way that a normal function is structured, except instead of containing code, the prototype ends in a semicolon.

answer Jun 27, 2014 by Pradeep Kumar Gautam
Similar Questions
0 votes

A related query, can someone help?

+1 vote

This was asked today in interview any pointer.

"Design a unique hash function for every tweet in Twitter"

...