". Here are some variable declaration examples: 1- int x; 2- char letter; 3- float the_float; It is p..." /> How To Declaring Variables In C++? ". Here are some variable declaration examples: 1- int x; 2- char letter; 3- float the_float; It is p..." /> ". Here are some variable declaration examples: 1- int x; 2- char letter; 3- float the_float; It is p..." />
Answers

Question and Answer:

  Home  Basic C++ Syntax

⟩ How to Declaring Variables in C++?

To declare a variable you use the syntax "type <name>". Here are some variable declaration examples:

1- int x;

2- char letter;

3- float the_float;

It is permissible to declare multiple variables of the same type on the same line; each one should be separated by a comma.

1- int a, b, c, d;

If you were watching closely, you might have seen that declaration of a variable is always followed by a semicolon (note that this is the same procedure used when you call a function).</name>

 251 views

More Questions for you: