Declare global variables : Global variables « Language « C Tutorial





A global variable is available to all functions in your program.

A local variable is available only to the function in which it's created.

  1. Global variables are declared outside of any function.
  2. Global variables are typically declared right before the main() function.
  3. You can also declare a group of global variables at one time:
int s,t;

And, you can preassign values to global variables, if you want:

char prompt[]="What?";










1.9.Global variables
1.9.1.Declare global variables
1.9.2.Define and use Global variables