Introduction to C

Table Of Content

Description

In order to implement algorithms and flow charts into a realistic process, programming languages are used. Since ‘C’ is a middle-level language and is reliable, simple and easy to use, it is used to understand and implement concepts of programming and bring algorithms and Flow charts into action. ‘C’ was developed at AT&T’s Bell laboratories in 1972 in USA. It was developed by Dennis Ritchie.

Features of C

  1. Most popular Operating Systems such as Windows, UNIX, Linux are written in C language due to its performance value and simplicity.
  2. ‘C’ language can be used to interface external hardware with the Operating System.
  3. It is called as a Middle-level language as it lies between High-level language like Pascal and Fortran and Low-level Assembly languages.

C Character Set

C has following Character sets

ASCII Values
Alphabets A, B, C, ………………. X, Y, Z
a, b ,c, ……………….. x, y, z
65,66,67, ………… 90,91
97,98,99, ………… 121,122


Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 48, 49, 50, …….. 55, 56, 57

Special Symbols ~,‘  !  @   #    %  ^   &  *  (  )   –   _  +  =  |  \  { }   [ ]   :   ;   “   ‘   <  >   .   ?   /

Above sets when combined form CONSTANTS, VARIABLES and KEYWORDS.

Note: Constant cannot change their value
Variables can have varying values.

Constants

They are categorized into two types:-

  • Primary Constant

Primary Constant

  • Secondary Constant

Secondary Constants

Rules for declaring ‘Constants’

  1. If no sign precedes integer or real constant, then it is assumed to be a Positive value.
  2. No special symbols or blanks are allowed
  3. Real constant must have a decimal point. For instance, +45 -74, – 4.1e8
  4. Maximum length of a character constant can be one character. For example, ‘C’, ‘$’ ‘I’.

‘C’ Variables

Variables hold a constant value. They act as a reference to memory occupied by a constant.

Rules for declaring variables

  • It is of 1 to 31 alphabets, digits or underscores.
  • It can begin from an alphabet or an Underscore but not a digit.
  • No blank spaces or any other special characters are allowed
    For example:  Sun, emp, – salary8_9

‘C’ Keywords

These are such terms in ‘C’ language which are already defined within the language. Either there is a value is defined or their function is defined, hence, they cannot be used as variables.

Total no of Reyads in C = 32

For example, – Unit, char, long, for, while, Goto, if, else, return, void, main are keywords in C.