C Syntax - Character Set, Keywords, Demiliters and Identifiers


Next >>

Instructions, Keywords and Symbols

We know that the program is a set of instructions that instructions are formed using certain words and symbols. C supports some kind of data that are used to write those words and symbols such as numbers, characters, strings and so on. Usually those words and symbols are written based on the syntax rules or the grammar rules of the language. In general, the programmers follow the syntax rules of the language for their programming. Here we see some of the basic syntax of the programming language.

C-Character Set

The character set used to form words, numbers and expressions. This is classified into different categories:

  • Letters

    C uses the english Alphabet in both form that are Capital letter A to Z and small letter a to z.

  • Digits

    C includes all decimal digits from 0 to 9.

  • White spaces

    C allows the white spaces present in the statement that spaces used to indicate where one word ends in the statement and beginning of the next word. The useful white spaces are included in c such as blank space, horizontal tab, vertical tab, new line and comments.

  • Special Character

    C supports some kind of special characters or symbol. The following are the list of special characters:

    ,comma .period or dot
    ;semicolon :colon
    'apostrophequotation mark
    !exclamation mark|vertical bar
    /slash \back slash
    ~tilde _underscore
    $dollar?question mark
    +plus <less than
    >greater than( )parenthesis
    [ ]bracket{ }brace
    %percent #number sign or Hash
    @at the rate =equals to


C uses special kind of symbols:

:     colon Useful for label
;     semicolon Terminates statement
( )   parenthesis Used in function and expression
[ ]   square bracket Used for array declaration
{ }   curly braceScope of the statement
#      hash Preprocessor directive
,      comma Variable separator


C has some reserved words that are used by the compiler which have fixed meaning. We cannot use these keywords as variable name or constant or function name. For using these keywords, we do not include any header file in our program. Following are the list of keywords; you should notice that all these keywords use lower case letter.

autodo intstruct
break elselongswitch
case externreturnunion
char enum registerunsigned
const floatshottypedef
continue forsignedvoid
double gotosizeofvolatile


In C, identifiers are used to refer number of things; variables name, functions name and arrays. The identifiers are the user-defined names which consist of sequence of letters, digits and ' _ ' underscore.

The rules for defining an identifier:

  • The first character must be a letter after that which includes underscore and digits.
  • The variable names may begin with '_' but this may be used only for library implementation.
  • The reserved keyword may not be used as an identifier.
  • Use lower case letter for variable name and upper case letter for symbolic constant.
  • The C is case sensitive programming language, so the identifier 'Woman' is different from the identifier 'woman'.
for example:
 Fact, myfunction, a, text, Text, _abc, sum, ADD, multi

<< Previous

Next >>