C Program Structure
A C program is a collection of statements, comments, and preprocessor
directives.
Statements
Statements, which may consist of variables, constants, operators and func-
tions, are terminated with a semicolon and perform the following opera-
tions:
•
Declare data variables and data structures
•
Define data space
•
Perform arithmetic and logical operations
•
Perform program control operations
One line can contain more than one statement. Compound statements are
one or more statements contained within a pair of braces and can be used
as a single statement. Some statements and preprocessor directives are
required in the Holtek C source files. The following is a shell:
void
main()
{
/* user application source code */
}
The main function is defined within the user application source code. There
may be more than one source file for an application, but only one source file
can contain the main function.
Comments
Comments are used to document the meaning and operation of the source
statements and can be placed anywhere in a program except for the middle
of a C keyword, function name or variable name. The C compiler ignores all
comments. Comments cannot be nested. The Holtek C compiler supports
two kinds of comments, block comment and line comment.
→
Block comment
The block comment begins with /* and ends with */, for example:
/* this is a block comment */
A block comment’s end character */ may be placed in a different line from
the beginning block comment characters. In this case all the characters
between the starting comment characters and end comment characters, are
treated as comments and ignored by the C compiler.
HT-IDE User’s Guide
86
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...