while declaring a variable, we need to declare its data type, which tells the compiler to reserve the number of bytes in…