When a local variable is defined, it is not initalised by the system, you must initalise it yourself. Global variables are initalised automatically by the system when you define them as follows:Data Type Initialserint 0char '\0'float 0double 0pointer NULL It is a good programming practice to initialize variables properly otherwise, sometime program would produce unexpected result.
C++
Topic: Variable
Explain about Initializing Local and Global Variables ?
Browse random answers:
Scope of variables
Explain about Initialization of variables ?
Explain about Variable Declaration in C++ ?
Explain about Variable Initialization in C++:
Explain about Initializing Local and Global Variables ?
Explain about Global Variables ?
Explain about Calculations and variables ?
Why global variables are evil ?
How to store letters in a variable?
declaring floating-point type variables
What are variable declaration in c++ syntax ?
Write a function using reference variables as arguments to swap the values of a pair of integers?
How to access change a variable using pointer in C++?
Write a program to declare two integer , one float variables and assign 10, 15, and 12.6 to them respectively. It then prints these values on the screen.
What is a Variable?
What is an algorithm (in terms of the STL/C++ standard library)?
what are auto static variables and auto extern variables?
How many ways are there to initialize an int with a constant?
How do you decide which integer type to use?
How is static variable stored in the memory?( if there are 2 functions in a file,and the static variable name is same (ex var) in both the function. how is it keep seperately in the memory).
What can I safely assume about the initial values of variables which are not explicitly initialized?
What?s the auto keyword good for?
What is the difference between declaration and definition?
How variable declaration in c++ differs that in c?
What is difference between followin intialization.int iVar1;int iVar2 = int();and which one of two should we prefer always and why?
Are private class-level variables inherited?
Are there any new intrinsic (built-in) data types?
I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?
When you inherit a protected class-level variable, who is it available to?
What is a node class in c++?
What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator.
Explain about Variables Data Types ?
Explain about Fundamental data types ?
Explain about Declaration of variables ?