Q:

How to make 3 bool global variable?

I'm creating a word game and I need to assign coins to a user:
firstly I've read over and over on subjects "Global variables" Unfortunately i'm not able to successfully do them. 
I need to make 3 bool global variable such as btn1Pressed,btn2Pressed,btn3Pressed. 
& how to make the word "coins" global of type int as well?
How is this done?
@interface MainView : 

A:

To declare global variables, you need to declare them outside of any class definition.  If I have a lot of global variables, I usually put them in their own source file and call it globals.m to help keep things organized.  If I only have one or two, I just declare them in the App delegate (after the #includes but before the @implementation).
int coins;
BOOL btn1Pressed;
BOOL btn2Pressed;
BOOL btn3Pressed;
// etc

Then you declare them in a common header (I use globals.h) as extern.  Declare them outside of any class definition:
extern int coins;
extern BOOL btn1Pressed;
extern BOOL btn2Pressed;
extern BOOL btn3Pressed;
...

That tells the compiler that "this variable is declared elsewhere", so it knows to resolve it at link time.  Include that header in any source module that needs access to those variables.

