Q11: What is variable? Explain declaration and initialization of variable.

 

A11: A variable represents a named storage location in a computer's memory. Variables are used to store and manipulate data during the execution of a program.

 

Declaration of a Variable:

 

Variable declaration is the process of specifying the variable's name and its data type to the compiler or interpreter.

Syntax: data_type variable_name;

 

Initialization of a Variable:

Variable initialization is the process of assigning an initial value to a variable at the time of declaration or at a later point in the program.

Syntax: data_type variable_name = initial_value; OR variable_name = initial_value;

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.