Are explicit declarations necessary?

Hans Albertsson hans at log-hb.UUCP
Sat Jun 16 07:40:02 AEST 1984


[]
Having looked through K&R carefully, and at lots of
C source too boot, I'm a bit bewildered; is code like

a;
funcname()
{
	a = 1;
	printf("%d",a);
}

at all permissible? Isn't it nessecary to declare a as int, even 
if my pcc-based compiler seems to think int is a kind of default?

As an aside, one of the contributions to the obfuscated code contest
did things like this.

K&R seems to permit dropping int only in connection with so called
"adjectives", that is:
unsigned a;
is ok, but only because unsigned is there.
-- 
			{decvax,philabs}!mcvax!enea!log-hb!hans
			Hans Albertsson, 
			TeleLOGIC AB
			Box 1001,
			S-14901 Nynashamn,
			SWEDEN



More information about the Comp.lang.c mailing list