Variables kinds and roles - C++
Hello!
Holly molly we almost made it, we almost can make our own first program in objective C++! Still we need tones of knowledge, but it is almost end for total basics. So we can start!
In C++ we have standard types for writing words and digits. For words we can use char or string which is array of char. String is very useful it have many functions which can make operations on him like cutting etc. In C++ std::string is dynamically allocated table - this mean you can add to string chars and string will allocate memory for you it is really great.
in other hand we wave much more options for save digits, because digits have infinity in plus, minus and after dot. So we cant save every digit, but sometimes we can approximate the number that is why we are using short, int etc for casual digits and float, double etc for digits witch dot.
Global variables - in C++ we have something which is available from any place. It is good and bad, because in modern programming we can use different methods to share something not globals. You need to know about globals, because even if something should be not used in normal situation, sometimes it can be important.
Different types are static variables which are global - exist even when class object not exist, but it can make sense to make it private sometimes. For example want you saw how many object of class exist etc. Static is one for every element in class so even if you have 100 object static variable is just 1 in memory.
That is all what i prepared for you today. Enjoy!
Ok, so we have the table for all of types