On Fri, 14 Nov 2003 15:32:17 +0530, Vijay Kumar R Zanvar wrote:
/* compatible.c */
#include <stdio.h>
struct A
{
int a;
char b;
};
int
main ( void )
{
struct A a = { 5, 'a' };
extern struct A b;
This means "declare b as a variable with external linkage of type
struct A". The struct A being referred to here is the struct A at
the beginning of file compatible.c
What you are specifying with the storage class specifier here is
that b is not a local variable in main. You are telling the
compiler to use some other b. Since there is no "other" b
defined in this code, it won't compile.
In the Standard, 6.2.2 says:
4 For an identifier declared with the storage-class specifier
extern ... If no prior declaration is visible ... then the
identifier has external linkage.