answersLogoWhite

0


Best Answer

...are important things in programming.

Example:

extern int variable; /* declaration */

int variable= 8; /* definition with initialization */

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is Variable declaration and variable initialization?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is initial variable?

Variable initialization is the assignment of an initial value to a variable.


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 */


Assigning a value to a variable in a declaration statement is called?

Answer is; initialization *** Edit*** Initialization is correct. Page 59 Programming Logic and Design by Tony Gladdis


What is the difference between declaring variable and initializing variables?

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 */


What is the intialization in c?

Initialization is nothing but assigning some value to a parameter. ex :- int a; // Defination of an integer variable a = 3; // Initialization of the variable a


What do you mean by initialization in c plus plus?

Not initialized variable: int myInt; Initialized variable: int myInt = 10;


What is an initialization statement?

When a declared variable receives a value to hold. i.e. int lalalala; lalalala = 0; //initialization of lalalala


What is the difference between instantiation and initialization in C plus plus?

Instantiation is creating the instance of the variable/object . While Initialization is to provide the variable with some value. int i; // i is an instance of an integer i=10; //initialised with the value 10


What is variable declarations?

A variable declaration is a math or programming term. A variable is an unnamed component. In the problem the wording will declare what the value of the variable is.


Where the declaration of c variable can be done?

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


What is different between a definition and declaration of a variable?

A declaration and definition of a variable are nearly synonymous, especially as it is found in source code. However, the concepts are separate. The definition of a variable may include variable name, type, scope, operating range, and initial value(s). Program documentation includes only the definition of a variable; not the declaration. It defines the meaning and use of a variable. Whereas the declaration of a variable indicates to the compiler/interpreter that the name should be recognized as a variable. Understand that when the variable declaration is given in source code it may include the definition, though not always. In some languages a variable may be declared and then defined later as to type, operating range, et al.


Difference between declaring a variable and definition a variable?

Declaration is a promise: 'I will define (or has defined) this variable/function somewhere else'.