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 6161 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!