Declaring externally-defined structures

John Gordon gordon at osiris.cso.uiuc.edu
Thu May 30 11:48:37 AEST 1991


	What you want is a global variable.  To make a variable global, 
declare it as normal, but do so outside of the functions.  Most people
put them at the top, after the #includes and #defines.  Example:

----------------------------------------
#include <stdio.h>

#define MAX 100

int gack; /* global! */

main()
{
...
...
}
-----------------------------------------

	Any function in the above file can use the global variable "gack". 


---
John Gordon
Internet: gordon at osiris.cso.uiuc.edu        #include <disclaimer.h>
          gordon at cerl.cecer.army.mil       #include <clever_saying.h>



More information about the Comp.lang.c mailing list