Computer Science, asked by nishapv7559, 2 months ago

Write the syntax to declare a variable in C++ with an example.​

Answers

Answered by abhinavpandey2
12

Answer:

Syntax:

  • char c; //character variable declaration.
  • int area; //integer variable declaration.
  • float num; //float variable declaration
Answered by zumba12
0

Syntax:

  • data_type variable_name; data_type variable_name, variable_name, variable_name; Here data_type approach the legitimate C++ facts kind which incorporates int, float, double, char, wchar_t, bool, and the variable listing is the lists of variable names to be declared that's separated through commas.

A variable is a call given to a reminiscence location and It is the fundamental unit of garage in an application.

  • The price saved in a variable may be modified in the course of application execution.
  • A variable is the handiest a call given to a reminiscence location, all of the operations completed at the variable outcomes that reminiscence location.
  • In C++, all of the variables have to be declared earlier than use.

For example, Declaring (Creating) Variables:

  • kind variableName = price; Where kind is one of the C++ types (which includes int ).
  • And variableName is the call of the variable (which includes x or myName). The same signal is used to assign values to the variable.

#SPJ2

Similar questions