5. How are variables declared and initialised in C++ and Java? Explain with examples.
Answers
Answered by
7
Explanation:
Variables are arbitrary names given to a memory location in the system. These memory locations addresses in the memory. Suppose we want to save our marks in memory. Now, these marks will get saved at a particular address in the memory. Now, whenever these marks will be updated, they will be stored at a different memory address. Thus, to facilitate the fetching of these memory addresses, variables are used. Variables are names given to these memory locations. The memory location referred to by this variable holds a value of our interest. Now, these variables once declared, are assigned some value. This assignment of value to these variables is called initialization of variables.
Similar questions