Teaching const

bs at alice.UUCP bs at alice.UUCP
Sun Apr 3 12:14:05 AEST 1988


In article <3300 at haddock.ISC.COM>, karl at haddock.UUCP writes:
> In article <10203 at steinmetz.steinmetz.ge.com> davidsen at kbsvax.steinmetz.UUCP (William E. Davidsen Jr) writes:
> >Could someone give me a good method to use when teaching students C,
> >such that they will be able to remember the syntax of
> >	pointer to {type} const
> >	- vs -
> >	const pointer to {type}
> 
> If you write "{type} const" rather than "const {type}", then "const" follows
> pretty much the same rules as "*".  You can use whatever method you use to
> distinguish "pointer to function" from "function returning pointer".
> 
> Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint

Try reading C declarations backwards (from right to left) they often
make sense that way. The ones that don't you might consider simplifying
using typedef.

s
i
l
l
y
f
o
o
d
f
o
r
m
a
i
l
e
r



More information about the Comp.lang.c mailing list