Mega Code Archive

 
Categories / C Tutorial / Language
 

Declare global variables

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. Global variables are declared outside of any function. Global variables are typically declared right before the main() function. 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?";