To find whether a certain variable is located in cache or not, the CPU needs to look into the main memory address of the variable that it is searching for. Then, based on the tag bits in that address (see more below,) the CPU will check inside cache if the variable is present in cache or not.
For this purpose, the main memory address is divided into sections:
RAM Address
+---------+-----------+------------+
| Tag | Block | Offset |
+---------+-----------+------------+