cs31day13 Wk 7 M

cs31day13 Wk 7 M - void f(.) void g(.) int main() cfw_...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
void f(. ..) void g(. ..) int main() { const string monthNames[12] = { // what if monthNames is needed in other functions "January", . ... }; f(monthNames,. ..); g(. ..); } void f(const string mn[],. ..) { ... } void g(. ..) { ... } ________________________________________________________________ _________________________________________ const declared outside of main() const string monthNames[12] = { //becomes a global variable - all functions can use it "January", . .. }; const int BLAH = 10; void f(. ..); void g(. ..); int main() { f(. ..); g(. ..); } void f(const string mn[],. ..)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
{ ... string BLAH = "Hello"; cout << BLAH; // bad style. this will cout Hello, not 10. don't do this. } void g(. ..) { ... } ________________________________________________________________ ________________________________________ for project 5, global constants are okay. can be used for Min length and Max length in project. ________________________________________________________________ _______________________________________ C++ strings
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2011 for the course CS 31 taught by Professor Melkanoff during the Spring '00 term at UCLA.

Page1 / 5

cs31day13 Wk 7 M - void f(.) void g(.) int main() cfw_...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online