Issue: What happens if we declare an identifier in a block, and then redeclare that same identifier in a block nested within that block?
Hypothesis: The compiler will not accept the same identifier declared in two nested blocks, one inside the other.
Experiment: We can answer this question by surrounding
our char declaration of arg1 with braces:
int main()
{
int arg1;
arg1 = -1;
...
{
char arg1 = 'A';
cout << arg1 << endl;
}
}
Observation: Compile and execute your program.
Question #8.8.1: Does it compile? If not, what error message does it produce? If it does, what does the program output?
Conclusion:
Question #8.8.2: Is our hypothesis correct? How do you know? If it's not correct, what should it be?