
C Programming Language-C has emerged as the most widely used programming language for software development. C was the offspring of the ‘Basic Combined Programming Language’ (BPCL) called B, the developed in the 1960’s at Cambridge University. B language was modified by Dennis Ritchie and was implemented at AT & T Bell laboratories in 1972. The new language was named C. It was developed along with the UNIX operating system, it is strongly associated with UNIX. The popularity of C is probably due to its many desirable qualities.
As a programming language, C is rather like Pascal or Fortran. Values are stored in variables. Programs are structured by defining and calling functions. Program flow is controlled using loops, if statements and function calls. Related data can be stored together in arrays or structures.
Of the three languages, C allows the most precise control of input and output. C is also rather more terse than Fortran or Pascal. This can result in short efficient programs, where the programmer has made wise use of C’s range of powerful operators. It also allows the programmer to produce programs which are impossible to understand.
Features of C
C is characterized by the ability to write very concise source programs, due in part to large number of operators included within the language. The language encourages users to write additional library functions of their own. The user can easily extend the features and capabilities of the language can easily.
Every version of C is accompanied by its own set of library functions, which are written for the particular characteristic of the host computer. The language lets the expert programmer express what they want in the minimum time by staying out of their way.
Characteristics of C
Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope and recursion, while a static type system prevents many unintended operations.
C exhibits the following more specific characteristics:
- Variables may be hidden in nested block.
- Partially weak typing; for instance, characters can be used as integers.
- Low-level access to computer memory by converting machine addresses to typed pointers.
- Function and data pointers supporting ad hoc run-time polymorphism.
- Array indexing as a secondary notion, defined in terms of pointer arithmetic.
- A preprocessor for macro definition, source code file inclusion and conditional compilation.
- Complex functionally such as I/O, string manipulation and mathematics functions consistently delegated to library routines.
- A relatively small set of reserved keywords.
- A large number of compound operator s, such as +=, -=, *=, ++ etc.
Overview of Compiler and Interpreter
A program is a set of instructions for performing a particular task. These instructions are just like English words. The computer processes the instructions as 1 and 0. A program can be written in assembly language as well as high level language. This written program is called source program. The source program is to be converted to the machine language, which is called an object program. Either an interpreter or a compiler will do this activity.
Interpreters
Interpreter is a kind of program translator which is used to convert the high level language into machine level language by converting it line by line. If there is any error in any line, it stops the execution of the program immediately and reports the user at the same time and program execution cannot resume until the error is rectified by the user. Interpreter is very useful for debugging and suitable for novice programmer. This is a slow process and consumes less memory. Interpreter is used in mostly fourth generation languages (4GL) like Visual basic, Web driven applications etc.
Interpreter characteristics:
- Relatively little time is spent analyzing and processing the program.
- The resulting code is some sort of intermediate code.
- The resulting code is interpreted by another program.
- Program execution is relatively slow.
Compliers
The name “compiler” is primarily used for programs that translate source code from a high level programming language to a lower level language which can be understood by the processor. For each high level language, the machine requires a separate compiler. If the compiled program can only run on a computer whose CPU or operating system is different from the one on which the compiler runs, the compiler is known as a cross-compiler. A program that translates from a low level language to a higher level one is a de-compiler.
The compiler has another task apart from translating your program. It also checks it to make sure that it is grammatically correct. Only when it is sure that there are no grammatical errors does it do the translation. Any errors that the compiler detects are called compile-time errors or syntax error. If it find so much as one syntax error, it stops compiling and reports the error to you.
Compiler characteristics:
- Spends a lot of time analyzing and processing the program.
- The resulting executable is some form of machine- specific binary code.
- The computer hardware interprets (executes) the resulting code.
- Program execution is fast.
Character Set of C
The characters used to form words, numbers and expressions depend upon the computer or which the program runs. The character in C are classified in the following categories.
- Letters
- Digits
- White Spaces
- Special Characters
Letters
- Capital A to Z
- Small a to z
Digits
All decimal digits 0 to 9
White Spaces
- Blank space
- Horizontal tab
- Vertical tab
- New line
- Form feed
Special Characters
, | Comma | & | Ampersand |
. | Period or dot | ^ | Caret |
; | Semi-colon | * | Asterisk |
: | Colon | – | Minus |
‘ | Apostrophe | + | Plus |
“ | Quotation mark | < | Less than |
! | Exclamation mark | > | Greater than |
| | Vertical bar | () | Parenthesis left/ right |
/ | Slash | [] | Bracket left/ right |
\ | Back Slash | {} | Braces left/ right |
~ | Tilde | % | Percent |
_ | Underscore | # | Number sign or Hash |
$ | Dollar | = | Equal to |
? | Question Mark | @ | At the rate |
Delimiters
Language pattern of C uses special kind of symbols, which are called as delimiters. They are given below:
Delimiters | Use |
: Colon | Useful for label |
; Semi-colon | Terminates statement |
() Parenthesis | Used in expression and function |
[] Square Bracket | Used for array declaration |
{} Curly Brace | Scope of statement |
# Hash | Preprocessor directive |
, Comma | Variable separator |
Keywords of C
The C keywords are reserved words by the compiler. The keyword cannot is used as variable names because they have been assigned fixed jobs.
C keywords
auto | double | int | struct |
break | else | long | switch |
case | enum | register | typedef |
char | extern | return | union |
const | float | short | unsigned |
continue | for | signed | void |
default | goto | sizeof | volatile |
do | if | static | while |
You can also join us at QUORA