0

What means declaring?

5th Nov 2016, 9:16 AM
liban farhan
liban farhan - avatar
2 Answers
+ 2
Declaring means that all the variables must be specified or initialised before you can use them, this allows the compilers to interpret statements correctly.
5th Nov 2016, 9:21 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
+ 1
Initialization is *not* part of a declaration. Giving a variable a value is called *definition*. Oftentimes this is done in one line but not necessarily. This difference is not to be a "smarty pants" about it, it has implications for C++. Variable declarations can be written without initialization. Using a declared but uninitialized variable leads to so-called "undefined behavior". In some cases this needs to be kept in mind as a variable might have to be declared but not immediately defined.
5th Nov 2016, 10:46 AM
Stefan
Stefan - avatar