answersLogoWhite

0

Because, by the rules of the language, all identifiers must be declared before or during initialization (and use). The only exception is that untyped functions are assumed to return an int. These are the C rules. For the C++ rules, it is the same, except that functions must also be declared.

The technical reason why is simply that the compiler is designed to be a single pass compiler, and that only works when you know the a priori type of an identifier.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Where the declaration of c variable can be done?

at orchard road on the shop where the variable can be done.


How a variable is declared and initialized during declaration in c?

During declaration, the declaration goes like this: extern <type> <variable-name> or <type> <function-name> (<parameter list>);


What is Variable declaration and variable initialization?

...are important things in programming. Example: extern int variable; /* declaration */ int variable= 8; /* definition with initialization */


What two things must you nor normally specify in a variable declaration?

In most programming languages, you do not need to specify the variable's type and initial value in a variable declaration. The type is usually inferred from the assigned value, and the initial value can be set separately if needed.


When variable in c gets memory After declaration or initialization?

Definition. Example: extern int x1; /* declaration */ int x2; /* definition */ int x3= 2; /* definition with initialization */


What is a declaring variable?

Variable declaration is when you declare a variable. For example: String foo; The data type is String and now I can modify foo and don't need to type String again. It can be an instance variable or a local variable.


What is a hole-in-scope?

when inner declaration of a variable hides its outer declaration


Explain the different access storage specifiers available in c?

The storage class specifiers in C and C++ are:autoexternmutableregisterstatictypedefA storage class specifier is used to refine the declaration of a variable, a function, and parameters


What is variable definition in c language?

variable definition means to declare the variable with its value. for example:- int i=10; this statement is a combination of declaration of integer i and assign its value to it,so it is a definition statement Note: assigning a value is not essential.


Why you have to declare variable first in turbo c?

All variables (and constants) must be declared before they can be used. This is so the compiler knows exactly how much memory to allocate to the variable, as the declaration tells the compiler exactly what the variable's type is.


What is the optional in a variable declaration statement?

Optional is the assignment of the value of course.int number; //Variable Declarationint number=2; //Assignment Declaration


What do you mean by implicit and explicit variable declartions?

Implicit variable declaration refers to defining a variable without explicitly stating its type, allowing the programming language to infer the type based on the assigned value. In contrast, explicit variable declaration involves clearly specifying the variable's type at the time of declaration, which can enhance code readability and type safety. For example, in languages like Python, variables are often implicitly declared, while in languages like Java or C++, explicit declaration is required. Both methods have their advantages and are used based on the programming context and language features.