Exploring the Evolution: C Language History and Latest Powerful Features in 2023

C Language History

C Language History

Let’s discuss the C Language History:

Feature Image Designs3
Dennis Ritchie
  • The C language history is started with Language BCPL (Basic Combined Programming Language) was developed by Martin Richards in the mid-1960s.
  • First version of Unix was written in low-level PDP-7 assembler language and soon after a language TMG was developed by R.M. McClure.
  • After that language B was developed by Ken Thompson in 1970 at Bell Labs.
  • In 1971, Dennis Ritchie began to extend the B language by adding character type and also rewrote its compiler to generate PDP-11 machine instruction. He called this new language as ‘new B’ or NB.
  • When PDP-11 computer arrived at Bell Labs, Dennis Ritchie create a new language based on B called C.
  • By early 1973,the essentials of modern C were complete.
  • During the 1980s the use of the C language spread widely and compilers became available on almost every machine architecture and operating system.

Latest Powerful Features of C Language in 2023

  • C has a powerful mix of high-level functionality and the detailed features required to program an operating system.
  • C is a small size language i.e. it has relatively small set of reserved keyword(only 32 in original C, and now 37 in C99).
  • It has extensive use of function calls.
  • It is a structured language.
  • C provides low-level access computer memory by converting machine address to typed pointers.
  • C provided non-nestable function definitions.
  • Variables in C may be hidden in nested blocks.
  • Complex functionality such as input/output,string manipulations and mathematical functions every time allotted to library routines.
  • In C, low level (bitwise) programming is readily available.
  • C supports extensive use of pointers for memory, array,structures and functions.

Limitation of C Language

  • Some of the programming features available in other programming language, but not in C are:
    1. C does not provide assignment of arrays or strings.
    2. C does not have automatic garbage collection.
    3. C has no requirement for bounds checking of arrays.
    4. C has no operations on whole array.
    5. It does not have syntax for ranges.
    6. C has no separate boolean type; it is handled by 0 and 1.
    7. C does not provide exception handling.
    8. Very limited support for object-oriented programming.
    9. No native support for multithreading and networking.
    10. No standard libraries for computer graphics.
  • A number of theses features are available as extensions in some compilers or they are supplied by third party libraries or also can be simulated by certain coding disciplines.

Uses of C Language

  • C Language has wide range of uses. Some of the uses are listed below:

    1. C became popular as a programming tool for personal computers for manufactures as well as commercial software.
    2. It is a widely used professional programming language.
    3. It is a widely used on many different software platforms and computer architectures.
    4. C has greatly influenced many other popular programming languages like C++ which originally began as an extension to C language.
    5. C is well suited for writing operating systems and control software.
    6. It is also used to control hardware at detailed level.
    7. Most of the modern operating systems are written in C or C++.
    8. The low level code like driver and kernel code is usually written in C.

Structure of C Program

#include<stdio.h>
main()
{
   ...
}
Function1()
{
  ...
}
Function2()
{
  ...
}

where,
# – preprocessor
include – directive
std – standard
io – input output
h – header
main – name of function
{ – start of block
} – end of block
Functional1 – User defined function
Functional2 – User defined function

  • #(hash) sign at the beginning of the line indicates that this is a preprocessor.
  • The # must start in first column and must have not embedded space.
  • The preprocess directive #include<studio.h> tells the compiler that the information about the standard input and output function is included in the header file stdio.h
  • main() is always the first function called when the program execution begins.
  • main() is a special function as the execution of every C program begins with the first statement in main() and ends with last statement in main()
  • Every C program must contain one and only one main() function.
  • { } is a block that contains set of statements.
  • The extension of C program is .c
  • File can be included in two ways. Note the following two forms:
    #include<stdio.h>
    #include”stdio.h”
  • In case of, #include”stdio.h”, it treats text in the file specified by filename as if it appeared in the current file. Compiler searches the source path first and then the include path. The include path is set using directories option of options menu of C editor.
  • If it is #include<stdio.h>,it works the same as #include”stdio.h“, but compiler does not search the source directory.

Editor for C Language

  • C program is just a set of instructions written in C language using any editor and saved with extension .c
  • Once a program is written, it is saved with file extension .c
  • First we have to compile program and then link.
  • C environment maintains three windows simultaneously.
    1) Edit Window
    2) Message Window
    3) Output Window
  • Edit window is used to develop/write the code.
  • On compiling/linking, message window shows list of errors and warnings.
  • Output window displays the output after successful execution.

C Program Execution Sequence

image

Variable and Symbolic Name

  • Variable is the name given to the memory location that stores data.
  • Variable is a data item whose value varies during the program. Each variable used in program must be declared at the beginning of the function.
  • All the variable must be declared before their use.
  • The declaration syntax for variable is
    data_type<variable_name>;
    Where data_type is any valid C datatype.
  • Variable declaration does two things:
    a) It tells the compiler what the variable name is
    b) It specifies what type of data the variable will hold.
  • An integer variable hold integer constant, floating point variable holds float(real) value etc.
  • A variable may be local or global.
  • Variable definition ends with semicolon.
  • The value of variable can be changed in a program.
  • Ex.
    int a, b, c=45;
    float p, q, r=2.5;
    char z=’#’;

Symbolic Name

  • Symbolic name is the name declared at the beginning of the program and assigned a constant value.
  • It is defined using preprocessor directive as below:
    #define symbolic_name value
  • Generally symbolic_name are written in uppercase to visually distinguish them from other variables.
  • Its definition does not end with semicolon.
  • These are not declared for any data type.
  • In the program we can not change the value of symbolic constant.
  • Ex.
    #define MAX 100
    #define PI 3.1415
    #define TOTAL_MARKS 50

Rules for constructing variable name

  • Variable name may be a combination of alphabets,digits or underscores.
  • Sometime,compilers in which case its length should not exceed 8 characters impose an additional constraint on the number of characters in the name.
  • First character must be alphabet or an underscore.
  • No comma or blank space is allowed.
  • Among the special symbols,only underscore can be used in variable name.
  • No word, having a reserved meaning in C can be used for variable name.
  • Following are examples of valid variable names:
    rollno RollNo
    roll_no Marks1
    Marks2 Marks3
    Name year
  • Following variable name are invalid:
    Roll No 1Marks 2Marks
    float void emp-name

Constant and Literals

  • Data can be represented as either constant or a variable.
  • Constant is a data item whose value remains unchanged throughout the program execution.
  • A constant is a data item that substitutes a literal.
  • A literal is a value that expressed as itself.
  • Constants are suitable in the situation where a specific unchanging value is to be used at various times during program.
  • Consider the following example,
    const TOTAL_MARKS = 100;
    const CITY = “MUMBAI”;
  • In above example, value 100 and MUMBAI are literals whereas TOTAL_MARKS and CITY are constants.
  • Instead of literals, if we use constants then it makes code more understandable i.e instead of using the expression marks<100 we can use marks<TOTAL_MARKS
  • Constants make programmer free from remembering what each literal should be.
  • If there are several literals then programmer can define them all in the beginning of the program and then work with constant names.
  • If we use literals throughout the program then it will be difficult to make changes at several places.
  • Few more examples are:
    const PI = 3.14;
    const PASSING_MARKS = 50;

One thought on “Exploring the Evolution: C Language History and Latest Powerful Features in 2023

Leave a Reply

Your email address will not be published. Required fields are marked *