Questions for: Declarations And Initializations
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.
#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;
- During declaration we tell the datatype of the Variable.
- During definition the value is initialized.
Discuss About this Question.
| 1 : | extern int x; |
| 2 : | float square ( float x ) { ... } |
| 3 : | double pow(double, double); |
double pow(double, double); - is a function prototype declaration.
Therefore, 1 and 3 are declarations. 2 is definition.
Discuss About this Question.
extern int i;
Declaring is the way a programmer tells the compiler to expect a particular type, be it a variable, class/struct/union type, a function type (prototype) or a particular object instance. (ie. extern int i)
Declaration never reserves any space for the variable or instance in the program's memory; it simply a "hint" to the compiler that a use of the variable or instance is expected in the program. This hinting is technically called "forward reference".
Discuss About this Question.
| 1 : | |
| 2 : | |
| 3 : | |
C data types classification are
- Primary data types
- int
- char
- float
- double
- void
- Secondary data types (or) User-defined data type
- Array
- Pointer
- Structure
- Union
- Enum
So, clearly long int l = 2.35; is not User-defined data type.
(i.e.long int l = 2.35; is the answer.)
Discuss About this Question.
Discuss About this Question.