C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - General Questions (Q.No. 9)
9.
Identify which of the following are declarations
1 : | extern int x; |
2 : | float square ( float x ) { ... } |
3 : | double pow(double, double); |
Answer: Option
Explanation:
extern int x; - is an external variable declaration.
double pow(double, double); - is a function prototype declaration.
Therefore, 1 and 3 are declarations. 2 is definition.
double pow(double, double); - is a function prototype declaration.
Therefore, 1 and 3 are declarations. 2 is definition.
Discussion:
37 comments Page 1 of 4.
Priyanka garg said:
8 years ago
double pow(double,double);
Is it not the function call?
Is it not the function call?
(1)
Priyanka said:
1 decade ago
Hi Lipsha,
void main()
{
int num1;
display(num1);
}
void display(int para1)
{
-----------
-----------
}
In This example:
-> num1 is actual definition or actual parameter.(Parameters used in Function declaration is called actual parameters.).
-> para1 is formal definition or formal parameters.(Parameters used in Function definition is called actual parameters.).
void main()
{
int num1;
display(num1);
}
void display(int para1)
{
-----------
-----------
}
In This example:
-> num1 is actual definition or actual parameter.(Parameters used in Function declaration is called actual parameters.).
-> para1 is formal definition or formal parameters.(Parameters used in Function definition is called actual parameters.).
Lipsha said:
1 decade ago
What is the difference between actual definition & formal definition?
Xyz said:
1 decade ago
float x;
Is this statement a declaration or definition?
It was mentioned as a definition in book.
Is this statement a declaration or definition?
It was mentioned as a definition in book.
Divya said:
10 years ago
Float x; is a declaration.
Babi said:
10 years ago
What is the difference between definition and declaration?
Sadhana said:
10 years ago
Can I have a example program on [double pow(double, double);]?
Shradha said:
9 years ago
What is extern?
Priyanga said:
9 years ago
Can anyone explain more about float square (float x) {....} clearly?
Lincy Joseph said:
8 years ago
What does the second line mean?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers