CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Scope

Scope of an identifier is the region in the program where this identifier is valid.

  • Scope is delimited by the braces;
  • An identifier declared outside all braces has global scope
  • The identifier is only known from the point it is declared until the end of its scope.

More than one object can have the same identifier

  • if they are not in the same scope;
  • If more than one is valid, the local scope is assumed

An object declared in a scope is:

  • created everytime the scope is entered;
  • deleted everytime the scope exited.