Overview Of ‘C’

History Of 'C'

  • C is structured, high level, machine independent language
  • Dennis Ritchie at Bell laboratories developed ‘C’ from ALGOL, BCPL & B. ’C’ uses many concepts from these languages and added the concept of data types & other powerful feature
  • In 1983, ANSI committee approved ANSI-C. It was then approved by ISO in 1990

Importance Of 'C'

  • Robust Language
  • Efficient and fast
  • Portable language (machine independent language)
  • Program debugging, testing & maintenance easier
  • OS like UNIX are written in ‘C’ because of its efficiency

Basic Structure Of 'C'

[caption id="attachment_1518" align="aligncenter" width="800"]Basic Structure Of C Program Basic Structure Of C Program[/caption]

Note

  • To compile this program press alt+F9 and run this program press ctrl+F9
  • \n used to go to next new line
  • %d used to print the integer values in output

Character Set Of 'C'

A character denotes any alphabet, digit or special symbol used to represent information. [caption id="attachment_1519" align="aligncenter" width="700"]Character Set Of C Program Character Set Of C Program[/caption]

C – Tokens Of 'C'

In a passage of text, individual words and punctuation marks are called Tokens. Similarly in ‘C’ program, the smallest individual units are known as tokens.
  • Keywords
  • Constants
  • Strings
  • Operators
  • Identifiers
  • Special symbols

Keywords And Identifiers Of 'C'

Keyword

All keywords have fixed meaning. There are 32 (reserved word) keywords available in C.
auto double int struct
break else long switch
case enum register typedef
char extern return union
continue for signed void
do if static while
default goto sizeof volatile
const float short unsigned

Identifier

Identifier refers to the names of variables, functions & arrays. These are user-defined names. Rules for identifiers
  • First character must be an alphabet (or underscore)
  • Must consist of only letters, digits or underscore
  • Only first 31 characters are significant
  • Cannot use a keyword
  • Must not contain white space

Constants Of 'C'

Constants refer to fixed values that do not change during the execution of a program. [caption id="attachment_1520" align="aligncenter" width="700"]Constants Of C Program Constants Of C Program[/caption] 'C' also supports some special backslash character constants that are used in output functions. Eg: \b (back space), \n (new line).