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);
1
2
1 and 3
3
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.
Discussion:
37 comments Page 2 of 4.

Sundar said:   1 decade ago
Hi Haritha,

It is the actual definition for the function 'square', which may or may not be declared previously.

Tharun said:   4 years ago
During declaration, we tell the datatype of the Variable.

During definition, the value is initialized.

Tunu said:   1 decade ago
During declaration we tell the datatype of the Variable.
During definition the value is initialized.

Xyz said:   1 decade ago
float x;

Is this statement a declaration or definition?
It was mentioned as a definition in book.

Aishu said:   1 decade ago
Can you tel me what is the difference between declaration and definition and state some examples?

@ deepti: said:   1 decade ago
What are string? how are they declared? and what is the null character ?why is it important?

Prabhu said:   1 decade ago
Declaration never reserves any space for the variable or instance in the program's memory.

Lipsha said:   1 decade ago
What is the difference between actual definition & formal definition?

Priyanga said:   10 years ago
Can anyone explain more about float square (float x) {....} clearly?

Aisha said:   8 years ago
Can you give an eg for initialization and explanation for output?


Post your comments here:

Your comments will be displayed after verification.