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 4 of 5.
Rajalakshmi said:
1 decade ago
What is difference between definition and declaration?
Gursimran said:
1 decade ago
What about initializing and defining. ?
Kavitha said:
1 decade ago
Hi tomson,
Declaration is
int a;
char b;
float c;
.....
Initialization is
a=10;
b='h';
c=1.2;
We can use both declaration and initialization at same time
int a=10;
char b='w';
......
I think so now u understand.
If you hav any other doubt ask me.
Declaration is
int a;
char b;
float c;
.....
Initialization is
a=10;
b='h';
c=1.2;
We can use both declaration and initialization at same time
int a=10;
char b='w';
......
I think so now u understand.
If you hav any other doubt ask me.
TOMSON said:
1 decade ago
What is the difference between initializing and declaring?
Shivaji said:
1 decade ago
#include<stdio.h>
int funcall(int,int);//function prototyping
void main()
{
int sum=0;
int a=10,b=30;
sum=funcall(a,b);
printf("\nsum is %d",sum);
}
int funcall(a,b) //function definition
{
int cal=a+b;
printf("\ncal=%d",cal);
return cal;
}
out put: 40
Sorry prathyusha ur output is wrong that is not 10, 30 is the anws.
We have not to declare a is must that is mandetory...
y b'case we already declaring function call dat is funcall(int,int)..
any how ur explaination is good...
Thank u mr.sundar
int funcall(int,int);//function prototyping
void main()
{
int sum=0;
int a=10,b=30;
sum=funcall(a,b);
printf("\nsum is %d",sum);
}
int funcall(a,b) //function definition
{
int cal=a+b;
printf("\ncal=%d",cal);
return cal;
}
out put: 40
Sorry prathyusha ur output is wrong that is not 10, 30 is the anws.
We have not to declare a is must that is mandetory...
y b'case we already declaring function call dat is funcall(int,int)..
any how ur explaination is good...
Thank u mr.sundar
Lodu said:
1 decade ago
Prototype means we specifies the interface of that declared function. And we will use that function for coherent task.
Anuj Kumar said:
1 decade ago
What is the diffetence between function declaration and prototyping ?
Prathyusha said:
1 decade ago
Thank you for your feedback @sundar.
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
#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!...
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers