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 2 of 5.
Lodu said:
1 decade ago
Prototype means we specifies the interface of that declared function. And we will use that function for coherent task.
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
TOMSON said:
1 decade ago
What is the difference between initializing and declaring?
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.
Gursimran said:
1 decade ago
What about initializing and defining. ?
Rajalakshmi said:
1 decade ago
What is difference between definition and declaration?
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("......");
}
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("......");
}
Ravi said:
1 decade ago
What is the calling function?
Pratham said:
1 decade ago
A function call is an expression containing a simple type name and a parenthesized argument list.
Sasikalaa.s said:
1 decade ago
What is the difference between prototyping and declaration ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers