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.

Ravi kiran said:   9 years ago
Please tell me the difference between declaration and definition.

RAJESH KUMAR said:   4 years ago
Thank You, everyone.

Likhitha said:   4 years ago
Thank you everyone for explaining.

TOMSON said:   1 decade ago
What is the difference between initializing and declaring?

Srinu said:   1 decade ago
What is prototype?

Amar said:   1 decade ago
Prototype means we specifies the interface of that declared function. And we will use that function for coherent task.

Megha tavrech said:   1 decade ago
Prototype means just declaring the function, not providing body?

I think now it is understandable.

Sundar said:   1 decade ago
Give me the definition for the declaring and the defining and also prototype.

Revathy said:   1 decade ago
int a;
is the declaration- it simply assigns the datatype for the variable

int a=10; is the definition- it assigns the value for the variable- the value given should match d datatype

Prathyusha said:   1 decade ago
#include<stdio.h>
int funcall(int,int);//function prototyping
void main()
{
int a,sum;
sum=funcall(10,20);
printf("sum is %d",sum);
}

int funcall(int a,int b)
{
int cal=a+b;
return cal;
}

Output: sum is 10

When compiler come across the statement: sum=funcall(10,20);
it wants to know wat type of value it will return.so at that time it will go and check whether function prototyping is given or not , to see the datatype of the parameter used by that function.

CORRECT ME IF I AM WRONG PLZ!...


Post your comments here:

Your comments will be displayed after verification.