Teach Yourself C in 21 Days

Previous chapterNext chapterContents


- B -

Reserved Words

The identifiers listed in Table B.1 are reserved C keywords. You shouldn't use them for any other purpose in a C program. They are allowed, of course, within double quotation marks.

Also included is a list of words that aren't reserved in C but are C++ reserved words. These C++ reserved words aren't described here, but if there's a chance your C programs might eventually be ported to C++, you need to avoid these words as well.

Table B.1. Reserved C keywords.

Keyword Description
asm Keyword that denotes inline assembly language code.
auto The default storage class.
break Command that exits for, while, switch, and do...while statements unconditionally.
case Command used within the switch statement.
char The simplest C data type.
const Data modifier that prevents a variable from being changed. See volatile.
continue Command that resets a for, while, or do...while statement to the next iteration.
default Command used within the switch statement to catch any instances not specified with a case statement.
do Looping command used in conjunction with the while statement. The loop will always execute at least once.
double Data type that can hold double-precision floating-point values.
else Statement signaling alternative statements to be executed when an if statement evaluates to FALSE.
enum Data type that allows variables to be declared that accept only certain values.
extern Data modifier indicating that a variable will be declared in another area of the program.
float Data type used for floating-point numbers.
for Looping command that contains initialization, incrementation, and conditional sections.
goto Command that causes a jump to a predefined label.
if Command used to change program flow based on a TRUE/FALSE decision.
int Data type used to hold integer values.
long Data type used to hold larger integer values than int.
register Storage modifier that specifies that a variable should be stored in a register if possible.
return Command that causes program flow to exit from the current function and return to the calling function. It can also be used to return a single value.
short Data type used to hold integers. It isn't commonly used, and it's the same size as an int on most computers.
signed Modifier used to signify that a variable can have both positive and negative values. See unsigned.
sizeof Operator that returns the size of the item in bytes.
static Modifier used to signify that the compiler should retain the variable's value.
struct Keyword used to combine C variables of any data type into a group.
switch Command used to change program flow in a multitude of directions. Used in conjunction with the case statement.
typedef Modifier used to create new names for existing variable and function types.
union Keyword used to allow multiple variables to share the same memory space.
unsigned Modifier used to signify that a variable will contain only positive values. See signed.
void Keyword used to signify either that a function doesn't return anything or that a pointer being used is considered generic or able to point to any data type.
volatile Modifier that signifies that a variable can be changed. See const.
while Looping statement that executes a section of code as long as a condition remains TRUE.

In addition to the preceding keywords, the following are C++ reserved words:

catch inline template
class new this
delete operator throw
except private try
finally protected virtual
friend public


Previous chapterNext chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.