Skip to main content


Character set, variables, constants and keywords

Character set:
Character set contains alphabets, numbers, and symbols for representing information. Following set shows characters used in C:

Alphabets


A,B,C,D……………X,Y,Z
A,b,c,d…………….x,y,z
Numbers

0,1,2,3,4,5,6,7,8,9
Special Symbols

?></.,;’:”[]{}\|*-+_()*&^%$#@!

Variables:
Variable is an entity which can change or it is a name of the memory location. It should start with only alphabets or underscore. Also called identifiers.
e.g.  int A=10;
consider memory location 1000 in a computer’s memory where 10 value is stored. So we can retrieve or modify value 10 through variable A.
       
Constants:
Constant is an entity which cannot change.
e.g. int A=10; 10 is a constant.

Types of constants:
1.Primary Constants
2.Secondary Constants

Constants

Range
Integer

-32768 to +32767
Float

-3.4e38 to +3.4e38
Character

-128 to 127

Integer constant:
e.g int A=10, B=32768;
In given example, B has value out of range of integer constant so
Float constant:
e.g float f=2.3e+20;
2.3e+20=2.3*1020

Character constant:
Character constant consist only single alphabet, number or special symbol enclosed in a single inverted comma.
e.g. char A=’3’; 

Keywords:
Keywords are reserved words whose meaning is known to the compiler. Keywords should be in lower case. There are 32 keywords in C language:

 void

 return
 int
 case
 double

 public
 char
 long
 goto

 for
 while
 static
 unsigned

 switch
break
 union
 auto

 volatile
 struct
 continue
 sizeof

 if
 else
 const
 float

 short
 signed
 default
 typedef

 enum
 extern
 do



Comments

  1. Replies
    1. enum is especially used for storing fixed constants. e.g. months of year or days of week

      Delete
  2. what are the terminator used in c?

    ReplyDelete
    Replies
    1. We are using semicolon(;) for terminate all statements in C. If considering string i.e. array of character, it is terminated by '\0'. Also array can be terminated by '\0' if you wish but it is not recommended. Important fact is '\0' and 0 is same i.e. ASCII value of '\0' is 0.

      Delete

Post a Comment

Popular posts from this blog

Let's start with the history of C Before beginning with programs in C, it would be interested to know the history of it. C language is invented by Dennis Ritchie at bell laboratories of AT and T in the USA. It is invented in 1972. Dennis Ritchie is known as the founder of C language. Initially, C is developed for the UNIX operating system, then it is used in applications. In the late seventies, it replaces more familiar languages like PL/I, ALGOL, etc. C seems so popular is because it is reliable, simple, and easy to use. Moreover, in industry newer languages, technologies come and vanish all day out, a language that is survived for three decades is C.Let's see the programming languages that were developed before the C language. Language  Year  Developed By  Algol  1960  International Group BCPL  1967  Martin Richard  B  1970  Ken Thompson ...