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 2 of 4.
Lincy Joseph said:
8 years ago
What does the second line mean?
Priyanga said:
9 years ago
Can anyone explain more about float square (float x) {....} clearly?
Shradha said:
10 years ago
What is extern?
Sadhana said:
10 years ago
Can I have a example program on [double pow(double, double);]?
Babi said:
10 years ago
What is the difference between definition and declaration?
Divya said:
1 decade ago
Float x; is a declaration.
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.
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?
Bhoopend said:
1 decade ago
float square(float x) {...} is both dec/def because in prototype square(float) does not reserve any space in memory as we declare square(float x) now it reserve memory for float variable x.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers