# C++ Varibles and data types.

In C++, variables are fundamental components that store data in memory. They serve as containers to hold values that can be manipulated and used within a program. Variables have various data types that determine what kind of data they can store and how they are stored in memory.

syntax for variable:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875900940/8e5c45a8-4dc8-40d5-9cbe-28e6d699f938.png align="center")

1. **Int**: Used for storing integer values (whole numbers), e.g., 1, -42, 1000.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875537418/826114ad-fccf-43cd-b50b-78d7180ab376.png align="center")
    
2. **Float**: Used for storing single-precision floating-point numbers (decimal numbers with limited precision), e.g., 3.14, -0.5, 123.456.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875597021/40533a20-e21d-4cef-a5d5-0a99b78f1233.png align="center")
    
3. **Char**: Used for storing single characters, e.g., 'A', 'b', '1'.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875662059/b47bd4a3-9cd0-475b-b5aa-57b169417013.png align="center")
    
4. **Bool**: Used for storing Boolean values, which can be either `true` or `false`.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875710157/7e4648e0-b927-4ebf-964c-7e0295caad67.png align="center")
    
5. **String**: A sequence of characters, used for storing text or strings of characters.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695875758757/6121079d-ca72-4394-83a6-3fe48c1c2e17.png align="center")
    
    **Declaring many variables**
    
    In C++ you can declare more than one variable. also, you can assign the same value to multiple variables in one line
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695876010864/57be877d-f2a6-445f-a163-801133c17b50.png align="center")
    
    The same value to the multiple variables.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695876143990/6da8c68e-1775-41ec-9162-01e4e5d80568.png align="center")
    
    Thanks for Reading,
    
    Mohammed Muqafamuddin.
