O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Global Variables

Variables defined outside of any function have global scope and thus are available from any function in the program, including main().

In C++, global variables are avoided because they can create very confusing code that is hard to maintain. You won't see global variables in any code in this book, nor in any programs I write.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required