Optional is the assignment of the value of course.
int number; //Variable Declaration
int number=2; //Assignment Declaration
Most programming languages require that you declare all of the variables that you intend to use in a program. A variable declaration is a statement that typically specifies two things about a variable:* The variable's name* The variable's data typePosted by Special:Contributions***EDIT***This can be found on page 56 in "Programming Logic and Design" by Tony Gladdis
...are important things in programming. Example: extern int variable; /* declaration */ int variable= 8; /* definition with initialization */
Answer is; initialization *** Edit*** Initialization is correct. Page 59 Programming Logic and Design by Tony Gladdis
when inner declaration of a variable hides its outer declaration
Maybe you misinterpret something? There doesnt seem to be a declaration of value, but maybe declaration of variable?
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.
Most programming languages require that you declare all of the variables that you intend to use in a program. A variable declaration is a statement that typically specifies two things about a variable:* The variable's name* The variable's data typePosted by Special:Contributions***EDIT***This can be found on page 56 in "Programming Logic and Design" by Tony Gladdis
type variable {[optional array size]} {= optional initializer};
...are important things in programming. Example: extern int variable; /* declaration */ int variable= 8; /* definition with initialization */
Answer is; initialization *** Edit*** Initialization is correct. Page 59 Programming Logic and Design by Tony Gladdis
False. A declaration is a public statement.
for (<exp1>; <exp2>; <exp3>) <statement> exp1 and exp3 are optional; statement can be null-statement or block-statement. Correction: All expressions are optional. An infinite loop has no expressions: for(;;);
when inner declaration of a variable hides its outer declaration
During declaration, the declaration goes like this: extern <type> <variable-name> or <type> <function-name> (<parameter list>);
Declaration is a formal or explicit statement or announcement. It can also refer to the act of making such a statement in a clear and direct manner.
Actually, there is a third step, call definition. Declaration is a statement to the compiler of what type an identifier is, definition is the allocation of memory for that identifier, and initialization is the assignment of an initial value to that identifier. Usually, declaration and definition are done together, but you can also add initialization in that step if desired. int a; /* declaration and definition */ a = 1; /* initialization */ int a = 1; /* declaration, definition, and initialization */ For the case of seperate declaration and definition, consider the struct... struct _mystruct { int a; }; /*declaration */ struct _mystruct mystruct; /* definition */ struct _mystruct { int a; } mystruct; /*declaration and definition */ Note: To be more precise: struct _mystruct; /* struct declaration */ struct _mystruct { int a; }; /* struct definition */ typedef struct _mystruct MYTYPE; /* type definition */ extern struct _mystruct mystructvar; /* variable declaration */ struct _mystruct mystructvar; /* variable definition */ struct _mystruct mystructvar = {7} ; /* variable definition with initialization */ struct _mystruct { int a; } mystruct; /* struct definition and variable definition */ extern struct _mystruct { int a; } mystruct; /* struct definition and variable declaration */
Maybe you misinterpret something? There doesnt seem to be a declaration of value, but maybe declaration of variable?