[Courses] [C] common keywords
KWMelvin
kwmelvin at intrex.net
Sun Dec 8 22:25:35 EST 2002
Re: C keywords
There are 32 C keywords, some of which are used less than others.
Most variables are automatic by default, so the keyword "auto"
is rarely used. C has the keyword "goto", but there seems to be
a stigma about using it, so I don't see it very often. The keyword
"register" isn't used that much anymore, since modern systems
are so fast (maybe it is used in the embedded world of C?).
The do/while construct isn't used very much, as most programmers
prefer to use a while/break combo, so include "do" in the list of
infrequently used keywords. Of course, there will always be someone
who uses all these keywords on a regular basis, but *I* don't see
them too often (what do *I* know anyway?). Anyway 32 - auto - goto -
register - do - volatile (when was the last time you saw the keyword
"volatile" in a C program?) = 27 keywords left. 26 if you say that
the keyword "signed" isn't used very often, since integers are
signed by default. So, these 26 keywords must be used more often:
break, case, char, const, continue, default, double, else, enum,
extern, float, for, if, int, long, return, short, sizeof, static,
struct, switch, typedef, union, unsigned, void, while
Of the 26 keywords left, I use the type specifiers: char, int, and
float more than double, long, short, or unsigned. But then again,
I don't do much number crunching.
If you really get down to it, you can use if/else in place of a
"switch/case/default", and "while" instead of "for", so that may
eliminate some leftover keywords.
So, for type: char, int, float
for selection: if, else
for looping: while
for jumps: break, continue, return
operator: sizeof
That might do it for some fundamental keywords. What do you think?
I think you can do quite a bit with those 10, no? Add a few library
functions, and you have enough material for several lessons.
Happy Programming!
--
K (just another beginner)
On Sun, Dec 08, 2002 at 03:19:40PM -0500, Morgon Kanter wrote:
> I have begun working on chapter 1 of the C tutorial, which is listing what
> you need, the pros and cons of C, common keywords, and your first C program.
> I am kind of stuck on what some of the real common keywords used and thrown
> around are, though. If you could respond to my personal address (not the list
> - that would be spammy! Unless it was requested by someone, of course) with
> some of the commonly used keywords to include, that would be great!
>
> That's all for now,
> Morgon
>
More information about the Courses
mailing list