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?
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 1 of 5.
Aditya said:
1 decade ago
If possible say what is "prototype" in explanation.
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.
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
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!...
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!...
Sundar said:
1 decade ago
@Prathyusha
This type of prototype declaration requires only in old compilers. (TurboC under 16-bit DOS OS).
But in modern compilers this function prototyping is not required.
GCC, VC++, C#, etc.
This type of prototype declaration requires only in old compilers. (TurboC under 16-bit DOS OS).
But in modern compilers this function prototyping is not required.
GCC, VC++, C#, etc.
Prathyusha said:
1 decade ago
Thank you for your feedback @sundar.
Anuj Kumar said:
1 decade ago
What is the diffetence between function declaration and prototyping ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers