Chapter 2.1 - Know the C Character set and keywords



C Character Set and Keywords


Know the C Character set

The characters can be used to form words, numbers and expressions depend upon the computer on which the program is run. However, a subset of characters is available that can be used on most personal, micro, mini and mainframe computers. The character in C is grouped into the following categories.
  1. Letters
  2. Digits
  3. Special CHaracters
  4. White Spaces
The entire character set is given in Table 2.1.

The compiler ignores white unless they are a part of a string constant. White spaces may be used to separate words, but are prohibited the character of keywords and identifiers. #allaboutprogramming62


Chapter 2.1 - Know the C Character set and keywords
Table 2.1    C Character Set







Trigraph Characters 

Many non-English keyboards do not support all the characters mentioned in Table 2.1. ANSI C introduces the concept of "trigraph" sequence to provide a way to enter certain characters that are not available on some keyboards. Each trigraph sequence consists of three characters (two question marks followed by another character) as shown in Table 2.2.

           Download Turbo C++ Program Compiler

           Download Code:: Block All Program Compiler

    For example, if a keyword does not support square brackets, we can still use them in a program using the trigraphs ?? (and??).


Chapter 2.1 - Know the C Character set and keywords
Table 2.2  ANSI C Trigraph Sequence



C TOKENS

In a passage of text, individuals words and punctuations marks are called tokens. Similarly, in a C programs, the smallest individuals units are known as  C tokens. C has six types of tokens as shown in Fig. 2.1.C programs are written using three tokens and the syntax of the language.

               Download Let us C eBook pdf - By Yashwant Kanetkar

               Program Compile on Android Mobile


Chapter 2.1 - Know the C Character set and keywords
Fig 2.1   C Tokens and Examples





KEYWORDS AND IDENTIFIERS

Every C word is classified as either a keyword or an identifier. All keywords have fixed meanings and these meanings cannot be changed. Keywords serve as basic building blocks for program statements. The list of all keywords of ANSI C is listed in Table 2.3. All keywords must be written in lowercase. Some compilers may use additional keywords that must be identified from the C manual.  


              Turbo C++ Software Solution

              Top 10 Useful Commands for Linux Users

Chapter 2.1 - Know the C Character set and keywords
Table 2.3   ANSI C Keyword

Identifiers refer to the names of variables, functions, and arrays. These are user-defined names and consist of a sequence of letters and digits, with a letter as a first character. Both uppercase and lowercase letters are permitted, although lowercase letters are commonly used as a link between two words in long identifiers.





Rules for Identifiers

  1. The first character must be an alphabet (or underscore).
  2. Must consist of only letters, digits or underscore.
  3. Only the first 31 characters are significant.
  4. Cannot use a keyword.
  5. Must not contain white spaces.




Note:- 

C99 adds some more keywords. See the Appendix "C99 Features".

Post a Comment

3 Comments


  1. How to Download PlayerUnknown's Battlegrounds for PC
    Download PUBG PC

    ReplyDelete
  2. Download Free KineMaster Pro Mod APK 2021 [Fully Unlocked]
    Download Now

    ReplyDelete
  3. Download Free Windows 11 All In One 32/64 Bit ISO Oct-2021
    Download Now

    ReplyDelete

Ask Me Everything About Programming.