Friday, April 29, 2016

Keywords,Identifiers,Comment,Header Files and Format Specifiers


Keyword

Keywords can be defined as reserved words and they cannot be used as names for the variables or other user defined program eliminates. Keywords are just like valid words in any language. The meaning of the keywords has already been given to the compiler. Example: int, char, float, if, else, break, continue, for, while, do case, etc.

Identifiers

Identifiers can be defined as the name of the variables, functions, arrays, structures, etc. created by the programmer. They are the fundamental requirement of any language. Identifiers are used to give unique names to the objects in the program. Keywords can also be considered to identifiers but they are used for very special meaning. Examples: Function name, array name, structure name, etc.

Rule for naming Identifiers:

--> An identifier is any combination of one or more letters or digits.

--> The first character in the identifier must be a letter.

--> It must not contain any character other than letters or digits.

--> The underscore is taken as a letter.

--> Identifiers may help any number of letters and digits.

--> Uppercase and lowercase letters are different.

Comment

A comment is a non-executable statement that gives information about the purpose of a particular variable or a function in a program. Comments in C are of two types:
--> Single Line Comment (| |)
-->Block Comment (/*......................................*/)

Example: // Welcome to C program
                /* this comment contain a number of lines */

Header Files

Header files are the files containing standard library functions. They have the extension .h. When we include header file, it include that they should be included at compilation. Generally, header files are kept at top of the program. Example: stdio.h, math.h, conio.h, stdlib.h, graphics.h, etc.

Format Specifiers

Format specifiers are the characters starting with percentage sign (%) and followed with a character. It specifies the type of data i.e. being processed. It is also called conversion specification. Some data types and their format specifier are as follows:


                           Data Type                            Format Specifier
                            Integer                                     % d
                      Unsigned Integer                                     % v
                      Long Integer                                     % ld
                            Float                                     % f
                          Double                                     % lf
                      Long Double                                     % lf
                          Character                                     % C
                            String                                     % S

No comments:

Post a Comment

Popular Posts