course.wilkes.edu/CS125Labs
Welcome to the site for CS 125 labs!

 

Experiment 8: auto Scope, Part II

The Question: What happens if we declare a name in a block, and then redeclare that name in a block nested within that block?

Hypothesis: Review the rules of scope, and then construct a hypothesis.



The Experiment: We can answer this question by surrounding our char declaration of arg1 with braces:

   int main()
   {
      int arg1;
      arg1 = -1;
      ...
      {
         char arg1 = 'A';
      }
   }

Observation: Translate your source program. What is displayed ?





Conclusions: Review the rules of scope and explain what happened.





 
  Home

Help

Lab 0

Lab 1

Lab 2

Lab 3a

Lab 3b

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13



Membership

Login




Last update: Wednesday, August 23, 2000 at 3:25:37 PM.
visitors to this page.