Welcome to Dream.In.Code
Become a C++ Expert!

Join 136,940 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,866 people online right now. Registration is fast and FREE... Join Now!




global vs. local

 
Reply to this topicStart new topic

global vs. local

Holden117
17 Mar, 2008 - 08:07 AM
Post #1

D.I.C Head
**

Joined: 16 Feb, 2008
Posts: 210


My Contributions
Ok I am working on a program that needs variables. The book I am using is telling me to use global. The book is out of date by 8 years and is telling me to do it in the C way. It's not C++. I only use the variables twice in the whole program. What do you all think I should do?
User is offlineProfile CardPM
+Quote Post

schnalf
RE: Global Vs. Local
17 Mar, 2008 - 08:34 AM
Post #2

D.I.C Head
**

Joined: 9 Feb, 2008
Posts: 124



Thanked: 2 times
My Contributions
the best way is to define the variables so local as possible.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Global Vs. Local
17 Mar, 2008 - 09:05 AM
Post #3

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,228



Thanked: 40 times
Dream Kudos: 25
My Contributions
Local variables are preferable to global.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/3/08 10:54PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month