global variables and external variables? 
Author Message
 global variables and external variables?

Quote:

>   what is the difference between global variables and external
> variables??

it depends what you mean by 'global'.  external variables are variables with
external linkage.  if you take 'global' to mean 'at file scope', then a
global variable may have internal or external linkage.

Quote:
> what does this mean ? "If the definition of a global variables and
> function includes the keyword static then  any declarations of that
> variables or function must also"
> Can anyone give a concrete example of this statement ??

/* inside a.c */
int foo;        /* externally linked "global" variable */
static int bar; /* internally linked "global" variable */

/* inside b.c */
extern int foo; /* cool: a.c:foo is externally linked */
extern int bar; /* not cool: this symbol will not resolve */

--
 /"\                                                 m i k e   b u r r e l l

  X        AGAINST HTML MAIL,



Thu, 13 Mar 2003 03:00:00 GMT  
 global variables and external variables?
  what is the difference between global variables and external
variables??

what does this mean ? "If the definition of a global variables and
function includes the keyword static then  any declarations of that
variables or function must also"
Can anyone give a concrete example of this statement ??



Thu, 13 Mar 2003 22:44:54 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Global variable or not global variable

2. Watcom C / external references to global variables.

3. static local variables vs global variables

4. Variables & Global Variables

5. Uninitialized global data (was Re: Global variables)

6. Help - I need to set variable A = value held in variable named in variable B

7. Why is not possible to assign a global variable to another global variable..?

8. Global variable

9. global variables

10. global variable

11. Regarding locks and global variables

12. C Program - Global, Private variable

 

 
Powered by phpBB® Forum Software