Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TheRealMAN11

Global variables from within functions

This topic is 6075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I there a way to declare global variables from within functions in C++ (or C for that matter)?
It is foolish for a wise man to be silent, but wise for a fool. Matthew WebMaster www.Matt-Land.com All your Xbox base are belong to Nintendo.

Share this post


Link to post
Share on other sites
Advertisement
No, but why would you want to? Well anyway, static variables in functions act like globals, except they can only be accessed within that one function.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
I would want to so that I could declare a variable or class at one point in the program then have it be accessable by other functions. That way my global classes are not intilized right away, and can you overload constructor functions?


It is foolish for a wise man to be silent, but wise for a fool.

Matthew
WebMaster
www.Matt-Land.com

All your Xbox base are belong to Nintendo.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!