C++ Variables and Variable Identifier :: DigitalStage Blogs

This video related to this article basically introduces what are the variables and variable identifiers in C++, how are they used and why are they important and also how to use them to make a program more useful.

Key terms:

  • Variable: Portion of memory to store and determine a certain value. 
  • Valid identifier: sequence of letters, numbers and underscore, and cannot start with number. Can start with underscore(_) but not recommended.
  • Reserved keywords: That are there already for compiler to use and we declaring them will just try to initialize again causing error.
  • List of reserved keywords:
    asm, auto, bool, break, case, catch, char, class, const, 
    const_cast, continue, default, delete, do, double, 
    dynamic_cast, else, enum, explicit, export, extern, 
    false, float, for, friend, goto, if, inline, int, long, 
    mutable, namespace, new, operator, private, protected, 
    public, register, reinterpret_cast, return, short, 
    signed, sizeof, static, static_cast, struct, switch, 
    template, this, throw, true, try, typedef, typeid, 
    typename, union, unsigned, using, virtual, void, 
    volatile, wchar_t, while 
  • Operator words that may be reserved:
    and, and_eq, bitand, bitor, compl, not, not_eq, or, 
    or_eq, xor, xor_eq
  • List of fundamental data type:
Type size Range
char 1 byte signed: -128 to 127
unsigned: 0 to 255
short int
(short)
2 bytes signed: -32768 to 32767
unsigned: 0 to 65535
int 4 bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
long int
(long)
4 bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
bool 1 byte true or false
float 4 bytes +/- 3.4e +/- 38 (~7 digits)
double 8 bytes +/- 1.7e +/- 308 (~15 digits)
long double 8 bytes +/- 1.7e +/- 308 (~15 digits)
wchar_t 2/4 bytes 1 wide character

 

  • Variables can be initialized basically in two ways:
    • int a = 10; or
    • int a (10);
  • string variable types can store bunch of characters.

 

Other Articles:

someImageHello everyone,

This is a very basic tutorial that involves on showing you how to get started with writing on C++ programming languages. I have a complete video on this. You can find it here: Getting started to C++.(Opens in new window).


Last modified: 11 years ago By: Suzzett

Let's say hello to C++ programming world:
#include<iostream>
using namespace std;
int main()
{
  cout << "Hello World" << endl; 
}

Last modified: 11 years ago By: Suzzett

This article is a bit of a explanation for my third video in C++ tutorial series. I will explain what are variable and data types in C++ and what you need to know about them while programming. So, let's get into it.

You can get to video here


Last modified: 11 years ago By: Suzzett

Hello Guys, I have had a lot of peoples coming to me asking about command line tutorials or at least have a little bit of understanding of command line so that they can get to my C++ programming tutorial series. So, this particular article is dedicated to those proples having trouble understanding why we use the Command Line Interface or otherwise known as CLI. I hope you will be able to make use of this tutorial to kick start your improved knowledge for computers.


Last modified: 11 years ago By: Suzzett




Comments:

Please login to post your thoughts!
 

There are no commnets yet!
 

Login

Username:
Password:
Don't have an account?
Register here
Register

Subscribe Youtube



Network DigitalStage.org


Some interesting stuffs