CS 6 - Overloading of variables: global variables that are...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS .7 notes cout<<” S m t w r f” for(int i=2; i<=31; i++) { if(i>0) cout <<setw(3)<<i; else cout <<setw(3)<<' '; if(0==(i+3)%7) cout << endl; } cout<<endl; Block Scope every program can have blocks or blocks within blocks. Global variables are defined outside all functions. Generally not a good idea for large programs.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Overloading of variables: global variables that are redefined in local blocks take the local definition. example of recursion: long func(long a); int main { cout&lt;&lt;func(5); return 0; } long func(long a) { if(a&gt;1) return (a*func(a-1)); else return 1; }...
View Full Document

Ask a homework question - tutors are online