The document outlines the fundamentals of C programming, detailing characters used, identifiers, keywords, and tokens. It explains that identifiers can consist of letters, numbers, and underscores, while keywords are predefined and not available for user-defined names. Additionally, it categorizes C tokens into six types, including keywords, constants, identifiers, string literals, operators, and separators.
Characters used inC
Alphabets
Uppercase letters A to Z
Lowercase letter a to z
Numbers
0 to 9
3.
+ plus ,comma < less than
- minus . full stop > greater than
* asterisk ; semicolon = equal to
/ slash : colon ( open parenthesis
back slash ' apostrophe ) close parenthesis
% percent " double quote [ open bracket
| vertical bar & ampersand ] close bracket
~ tilde # hash { open set bracket
? question mark $ dollar } close set bracket
! exclamation mark ^ caret _ underscore
Special characters
4.
Identifier
An identifier isa name having a few letters , numbers and special character
_(underscore). It is used to identify a variable, function, symbolic constant and so on.
An identifier can be written with a maximum of 31 characters. It is a good practice to
have identifiers with few letters; less than 8 letters is commonly followed with the first
letter being an alphabet.
Example
x2 , sum (can be used as variables)
calcu_avg , matadd (can be used as function names)
pi, sigma (can be used as symbolic constants)
5.
Keywords or ReservedWords
C language uses the following keywords which are not available to users to use
them as variables/function names. Keywords are always written with the lower
case letters. Some C compilers use more keywords which they include in their
documentation or manual pages.
auto default float register struct
volatile break do for return
switch while case double goto
short typedef char else if
signed union const enum int
sizeof unsigned continue extern long
static void
6.
Tokens
C program hassome punctuation marks, keywords and operators as the smallest
individual units and are referred to as C tokens. Following six types of tokens are used in
C language.
C tokens Example
Keywords auto, break , etc
Constants -25 , 3.15 , etc
Identifiers calcu_avg , sum , etc
String literals “Total Amount Rs. ”
Operators + , - , * , etc
Separators ' ; :