AI Features

Solution Review: Initialize a Variable and Overwrite its Value

Let's see the detailed solution review of the challenge given in the previous lesson.

We'll cover the following...

Solution

C++
#include <iostream>
using namespace std;
int main() {
// Initialize variable var to 5000
int var = 5000;
// Prints value of var
cout << "var = " << var << endl;
// Overwrite value of var to 1000
var = 1000;
// Prints new value of var
cout << "var = " << var ;
}

Explanation

Line No. 7: ...