Customizable training materials to learn C++

Looking for C++ Tutorial Visit Nano teach c++!
  • C++ Compute the Sum and Average of Two Numbers
    03/07/2014 - 0 Comments
    This program takes in two integers x and y as a screen input from the user. The sum and average of these two integers are calculated and outputted using the ‘cout’…
  • C++ Variables
    10/07/2014 - 0 Comments
    In C++ Programming language variable is used to store data in memory location. Rules of Declaring variables in C++ Variable name can consist of Capital letters A-Z, lowercase…
Nano teach C++ found result for your search here:

C++ Variables

In C++ Programming language variable is used to store data in memory location.

Rules of Declaring variables in C++

  • Variable name can consist of Capital letters A-Z, lowercase letters a-z, digits 0-9, and the underscore character.
  • The first character must be a letter or underscore.
  • Blank spaces cannot be used in variable names.
  • Special characters like #, $ are not allowed.
  • C++ keywords can not be used as variable names.
  • Variable names are case sensitive.
  • A variable name can be consist of 31 characters only if we declare a variable more than 1 characters compiler will ignore after 31 characters.

Variable Definition in C++

Syntax:
type variable_name;
type variable_name, variable_name, variable_name;
Example:
/* variable definition and initialization */
int    width, height=5;
char   letter='A';
float  age, area;
double d;

/* actual initialization */
width = 10;
age = 26.5;

No comments:

Post a Comment