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:
6 years ago
double pow(double,double);
Is it not the function call?
Is it not the function call?
Priyanka said:
9 years 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.).
Xyz said:
9 years 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:
8 years ago
Float x; is a declaration.
Babi said:
8 years ago
What is the difference between definition and declaration?
Sadhana said:
8 years ago
Can I have a example program on [double pow(double, double);]?
Shradha said:
8 years ago
What is extern?
Priyanga said:
7 years ago
Can anyone explain more about float square (float x) {....} clearly?
Lincy Joseph said:
7 years ago
What does the second line mean?
San said:
7 years ago
If pow is the functional means then what about pow?
Is it also expanded as the power of right? Do clearly explain anyone?
Is it also expanded as the power of right? Do clearly explain anyone?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers