C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 11)
11.
When we mention the prototype of a function?
Defining
Declaring
Prototyping
Calling
Answer: Option
Explanation:

A function prototype in C or C++ is a declaration of a function that omits the function body but does specify the function's name, argument types and return type.

While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.

Discussion:
46 comments Page 3 of 5.

Ashutosh said:   1 decade ago
Prototype means declaration of function which is specially use in the program.

Shanker said:   1 decade ago
Definition of prototype means declaration of function. It's tell the compiler -this type of function are used in a program.

DHANUNJAY said:   1 decade ago
Prototype is nothing but an outlook, by seeing it we can able to understand what is the matter that it is going to represent in the program. It just says the information about a particular declared variable or a function. I think your dbt was clarified.

Sankar said:   1 decade ago
What is prototype?

Sindhu said:   1 decade ago
What does exactly prototype mean?

Gurpreet Sidhu said:   1 decade ago
Prototyping means declaring a function.
Now What is declaration and definition?

In term of variables:

extern int a; //It is a declaration. Declaration means variable is not present at that time in memory.It will come in memory at the time of execution.

int a; //It is a declaration as well as definition. Definition means variable is present in memory. Where extern tells the compiler that a variable of type int and named 'a' will be linked to the program at runtime.

In term of Functions:

extern int fun(); //it is a prototype which tells the compiler that a function named 'fun' which will be linked at runtime may be present in the same file or outside the file.

int fun(); //it is a prototype which tells the compiler that a function named 'fun' which will be linked at runtime will be defined in the same file.

Sasikalaa.s said:   1 decade ago
What is the difference between prototyping and declaration ?

Pratham said:   1 decade ago
A function call is an expression containing a simple type name and a parenthesized argument list.

Ravi said:   1 decade ago
What is the calling function?

Swapnil said:   1 decade ago
Declaration is the process of declaring the variable with some special name and its data-type,scope,memory storage etc. and definition is actually assining some value to that variable.

In case of function declaration is defining its prototype and declaration is code where we specify what the function actually does.

Examples:

case 1) variable

Variable Declaration:
int a,b[10];

Variable Definition:
a=1, b={1,2,3,....};


Function Declaration:
void display();

Function Definition:

void display()
{
printf("......");
}


Post your comments here:

Your comments will be displayed after verification.