Elements of the CC Language

The C programming language has its own syntaxa specific form in which all commands and code must be written in order to be understood and processed by the computer system. The syntax you should understand when beginning to program in C includes the following:

• Comments Comments are statements that document code and describe the program. A comment begins and ends with special characters, such as /* and */, that tell the compiler to ignore all content between those characters.

• Identifiers You need to know how to properly name values, variables, and subroutines, such as &a, *p, and my_func() .

• Keywords Keywords are words that have special meaning to C and are therefore reserved for commands or parameters. The keywords int, char, and struct, for example, are used to declare variables, arrays, structures, and so on.

• Constants You need to know how to use constants such as integers, floating-point numbers, characters, and character strings, such as 10, a, and "hello", and you need to know how to define symbolic constants, such as #define null 0.

• Syntax notation You need to know how to use operators in expressions, which are used for calculations, retrieval, or assignment of values, such as for (;;) and line[n++] = a;.

You should also learn more about the software tools you will use for programming and the idiosyncrasies and features of the tools, such as GNU's gcc compiler system. (See the section "Using the GNU C Compiler," later in this chapter, for an overview of gcc.)


Was this article helpful?

0 0

Post a comment