Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!mailrus!umix!umich!mibte!gamma!ulysses!andante!alice!bs From: bs@alice.UUCP Newsgroups: comp.lang.c Subject: Re: Teaching const Summary: backwards Message-ID: <7788@alice.UUCP> Date: 3 Apr 88 02:14:05 GMT References: <7712@apple.Apple.Com> <3034@haddock.ISC.COM> <613@mcrware.UUCP> <3300@haddock.ISC.COM> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 37 In article <3300@haddock.ISC.COM>, karl@haddock.UUCP writes: > In article <10203@steinmetz.steinmetz.ge.com> davidsen@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@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