auto type in cpp
#include <iostream>
int main() {
// Step 1: Declare a variable and initialize it
auto variable = 42;
// Step 2: Print the value of the variable
std::cout << "Value of variable: " << variable << std::endl;
// Step 3: Change the type of the variable
variable = 3.14;
// Step 4: Print the updated value of the variable
std::cout << "Updated value of variable: " << variable << std::endl;
return 0;
}