of     1   

backnobbers
#116165213Tuesday, October 22, 2013 2:22 AM GMT

Lets say you declare a variable in one function int main(){ a = 10; return 0; Once you put that variable in another function, would it still be seen as 10, assuming it has not been changed? int NewFunc(){ std::cout << a; return 0; When life gives you tomatoes, you grow carrots. -nobbers12345
backnobbers
#116165503Tuesday, October 22, 2013 2:25 AM GMT

o u guis i no u got som dat C++ 1337 skillz. When life gives you tomatoes, you grow carrots. -nobbers12345
FriendlyBiscuit
#116166080Tuesday, October 22, 2013 2:31 AM GMT

1) Stop being impatient 2) No, the variable won't exist. It isn't declared in the scope of NewFunc(); Try the following: pastebin/Xk3PQP2D
backnobbers
#116166296Tuesday, October 22, 2013 2:33 AM GMT

Okay, thanks. When life gives you tomatoes, you grow carrots. -nobbers12345
FriendlyBiscuit
#116166596Tuesday, October 22, 2013 2:36 AM GMT

Wait, that's not a proper example. Try this: pastebin/F41g9dPK
FriendlyBiscuit
#116166800Tuesday, October 22, 2013 2:39 AM GMT

Glad I put that mistake warning at the top. I forgot a : on line 0 on std::endl; (I put std:endl;)
NecroBumpist
#116166987Tuesday, October 22, 2013 2:41 AM GMT

Compile it yourself? Or use codepad.org? You're missing a colon on line 20. Otherwise, it works as expected. Avoid global variables in the future.
FriendlyBiscuit
#116167011Tuesday, October 22, 2013 2:41 AM GMT

If you're wondering about my C-style coding, I don't really do C++. I'm more of a C kinda guy.
FriendlyBiscuit
#116167136Tuesday, October 22, 2013 2:43 AM GMT

Necro: I'm rushing. I have a lot to do in the next 15 minutes.
NSOUND
#116363331Friday, October 25, 2013 2:18 AM GMT

when life gives lemons paint shat gold

    of     1