Typed variable
Try it yourself →Variable with a specified type.
Syntax
type name = value;
Description
C++ is statically typed: int, double, char, bool, string. Requires <string> for string.
Example
#include <iostream>
#include <string>
using namespace std;
int main() {
int age = 36;
string name = "Alex";
cout << name << " " << age << endl;
return 0;
}Expected output
Alex 36
When to use?
Storing all kinds of data.