typedef's & cc

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Tue Nov 13 00:35:57 AEST 1984


> typedef int foo;
> 
> main()
> {
> 	auto int foo;
> 
> 	foo = 2;
> }
> 
> Stylistic considerations aside, why isn't foo a variable inside main,
> and a type outside?

Typedefs are not scoped.  They define synonyms for (possibly complicated)
data types.  After "typedef int foo;", "foo" is just like "int".



More information about the Comp.lang.c mailing list