1 | P a g e
Concept of Programming language
A programming language is a computer language programmers use to develop software
programs, scripts, or other sets of instructions for computers to execute.
Once a programmer learns the languages rules, syntax, and structure, they write the source
code in a text editor or IDE. Then, the programmer often compiles the code into machine
language that can be understood by the computer. Scripting languages, which do not require a
compiler, use an interpreter to execute the script.
A programming language is a vocabulary and set of grammatical rules for instructing
a computer or computing device to perform specific tasks. The term programming
language usually refers to high-level languages,
Such as BASIC, C, C++, COBOL, Java, FORTRAN, Ada, and Pascal.
Generation of Programming Languages
There are five generations of Programming languages. They are:
First Generation Languages : (M.L.L)
These are low-level languages like machine language.
Second Generation Languages : (L.L)
These are low-level assembly languages used in kernels and hardware drives.
Third Generation Languages : (H.L.L)
These are high-level languages like C, C++, Java, Visual Basic, and JavaScript.
Fourth Generation Languages :
These are languages that consist of statements that are similar to statements in the human
language. These are used mainly in database programming and scripting. Examples of
these languages include Perl, Python, Ruby, SQL, MatLab(MatrixLaboratory).
Fifth Generation Languages :
These are the programming languages that have visual tools to develop a program. Examples
of fifth-generation languages include Mercury, OPS5, and Prolog.
The first two generations are called low-level languages. The next three generations are
called high-level languages.
2 | P a g e
3 | P a g e
1. First Generation Language :
The first generation languages are also called machine languages/ 1G language. This
language is machine-dependent. The machine language statements are written in binary code
(0/1 form) because the computer can understand only binary language.
Advantages :
1. Fast & efficient as statements are directly written in binary language.
2. No translator is required.
Disadvantages :
1. Difficult to learn binary codes.
2. Difficult to understand – both programs & where the error occurred.
2. Second Generation Language :
The second-generation languages are also called assembler languages/ 2G languages.
Assembly language contains human-readable notations that can be further converted to
machine language using an assembler.
Assembler – converts assembly level instructions to machine level instructions.
Programmers can write the code using symbolic instruction codes that are meaningful
abbreviations of mnemonics. It is also known as low-level language.
Advantages :
1. It is easier to understand if compared to machine language.
2. Modifications are easy.
3. Correction & location of errors are easy.
Disadvantages :
1. Assembler is required.
2. This language is architecture /machine-dependent, with a different instruction set for
different machines.
4 | P a g e
3. Third Generation Language :
The third generation is also called procedural language /3 GL. It consists of the use of a series
of English-like words that humans can understand easily, to write instructions. Its also called
High-Level Programming Language. For execution, a program in this language needs to be
translated into machine language using Compiler/ Interpreter. Examples of this type of
language are C, PASCAL, FORTRAN, COBOL, etc.
Advantages :
1. Use of English-like words makes it a human-understandable language.
2. Lesser number of lines of code as compared to above 2 languages.
3. Same code can be copied to another machine & executed on that machine by using
compiler-specific to that machine.
Disadvantages :
1. Compiler/ interpreter is needed.
2. Different compilers are needed for different machines.
4. Fourth Generation Language :
The fourth-generation language is also called a non – procedural language/ 4GL. It enables
users to access the database. Examples: SQL, Foxpro, Focus, etc.
These languages are also human-friendly to understand.
Advantages :
1. Easy to understand & learn.
2. Less time required for application creation.
3. It is less prone to errors.
Disadvantages :
1. Memory consumption is high.
2. Has poor control over Hardware.
3. Less flexible.
5. Fifth Generation Language :
The fifth-generation languages are also called 5GL. It is based on the concept of artificial
intelligence(A.I). It uses the concept that rather than solving a problem algorithmically, an
application can be built to solve it based on some constraints, i.e., we make computers learn
to solve any problem. Parallel Processing & superconductors are used for this type of
language to make real artificial intelligence.
Example: PROLOG, LISP, etc.
Advantages :
1. Machines can make decisions.
5 | P a g e
2. Programmer effort reduces to solve a problem.
3. Easier than 3GL or 4GL to learn and use.
Disadvantages :
1. Complex and long code.
2. More resources are required & they are expensive too.
6 | P a g e
C Programming
C is a procedural and general-purpose programming language that is used most widely for
system programming. Dennis Ritchie initially developed C in between 1972 and 1973 at Bell
Labs. American National Standard Institute (ANSI) later formalized this programming
language in 1988. The initial purpose of the development of the C programming language
was to make utilities of the UNIX based operating system. Directly or indirectly many other
computer programming languages have taken/borrowed features from C programming
language. Program written in C can be very efficiently mapped to machine instructions which
make C programming very much popular to use for any embedded software application
development which runs on a microcontroller.
C programming is considered as the base for other programming languages, that is why it is
known as mother language.
It can be defined by the following ways:
1. Mother language
2. System programming language
3. Procedure-oriented programming language
4. Structured programming language
5. Mid-level programming language
1) C as a mother language
C language is considered as the mother language of all the modern programming
languages because most of the compilers, JVMs, Kernels, etc. are written in C
language, and most of the programming languages follow C syntax, for example, C++,
Java, C#, etc.
It provides the core concepts like the array, strings, functions, file handling, etc. that are being
used in many languages like C++, Java, C#, etc.
7 | P a g e
2) C as a system programming language
A system programming language is used to create system software. C language is a
system programming language because it can be used to do low-level programming
(for example driver and kernel). It is generally used to create hardware devices, OS,
drivers, kernels, etc. For example, Linux kernel is written in C.
It can't be used for internet programming like Java, .Net, PHP, etc.
3) C as a procedural language
A procedure is known as a function, method, routine, subroutine, etc. A procedural
language specifies a series of steps for the program to solve the problem.
A procedural language breaks the program into functions, data structures, etc.
C is a procedural language. In C, variables and function prototypes must be declared
before being used.
4) C as a structured programming language
A structured programming language is a subset of the procedural language. Structure
means to break a program into parts or blocks so that it may be easy to understand.
In the C language, we break the program into small-small modules, each module
performs specific task. Each module is defined by using function. It makes the program
easier to understand and modify.
5) C as a mid-level programming language
C is considered as a middle-level language because it supports the feature of both low-
level and high-level languages. C language program is converted into assembly code, it
supports pointer arithmetic (low-level), but it is machine independent (a feature of high-
level).
A Low-level language is specific to one machine, i.e., machine dependent. It is machine
dependent, fast to run. But it is not easy to understand.
A High-Level language is not specific to one machine, i.e., machine independent. It is
easy to understand.
8 | P a g e
Why do we need to learn C?
 C is the most widely and commonly used programming language to develop
the different operating systems. The popular operating systems like UNIX and
LINUX are written in C.
 C program allows programs to maintain portable and compact code along with
maintaining performance and minimizing CPU constraints like memory and
execution time etc.
 C programming language allows programmers to control memory
allocation and reallocation which will be very helpful while working with
software development for small embedded systems.
 C is middle-level language and very fast in terms of execution compared
to other programming languages.
 Different algorithms and data structures can be implemented using C language
very efficiently which can be used in may software applications.
 Due to the portability feature of C programming language, the C
program written for one computer platform can easily be run on different
other platforms with very little modification in code.
 Various compilers that are used for other programming languages can be very
efficiently designed and developed using the C programming language.
Applications of C
 To develop and design system software like compilers for other programming
languages.
 To develop different operating systems for embedded devices and kernels.
 To develop graphics related software like gaming application.
 To design and develop network device software.
 To develop a software system where memory and execution time is constraint
like software for microcontrollers which is mainly used for small embedded
systems.
 Used for systems that require direct access/modification of data from memory.
9 | P a g e
Uses of programming language ‘C’
 Operating Systems: It is used to program Operating systems like Windows, Linux,
Mac. Kernel, which is also known as a central part of an OS, is mostly developed in
the C language.
 Mobile Phone: Mobile phone kernels are also written using this language. So, the
smartphones which we have in our hands all the time are running on C kernel.
 Mobile Applications: Languages like C++, C#, Objective-C is derived from it and
are used to make phone and web applications.
 Databases: Many popular databases like MySQL, Oracle Database, MS SQL Server
are written using this language.
 3D movies, Animation, Computer Graphics: Applications which make 3D movies,
Animation, Computer Graphics need to be fast and efficient. Therefore, we code
these applications in C, as it is very efficient and fast.
 Embedded Systems: Embedded systems like Mp3 player, Alarm clock, radio,
microwave, coffee making machine, sensors in the car etc., are coded and
programmed in C.
Advantages of programming language ‘C’
Below are the advantages:
 Portable: Its portability allows code to run on different computers and different
operating systems without making any change.
 Efficient: It is a general-purpose programming language. Therefore it
works efficiently.
 Case-sensitive: You need to be very careful while writing the code as it
treats lowercase and uppercase letter differently.
 Memory Manipulation and allocation: It has the ability to manipulate arbitrary
memory addresses. It also allows allocating the memory dynamically.
 Middle-level language: It merges the features of both low level and high-level
languages in itself.
Therefore, it can be used for both:
1. Low-level programming: Like in the development of Kernels
2. High-level programming: Like in the development of applications.
 Structured programming language: It is a structured programming
language. Therefore, a complex program can be broken into different
functions.
 Ability to extend itself: Since the library supports it, it allows us to add our
own functions to its library.
10 | P a g
e
11 | P a g
e
Why should we use C Language?
We should use this language because of the following reasons:
 First, it makes the code size small.
 It is efficient, portable, structured and well understood.
 It has only 32 keywords which are easy to remember.
 It is near to Assembly language as code written in C language runs as fast as code
written in assembly language.
 It has Pointers that connects hardware like kernel, drivers to a system; because of this
reason, C will always be in use.
12 | P a g
e

Fundamentals of Programming language.docx

  • 1.
    1 | Pa g e Concept of Programming language A programming language is a computer language programmers use to develop software programs, scripts, or other sets of instructions for computers to execute. Once a programmer learns the languages rules, syntax, and structure, they write the source code in a text editor or IDE. Then, the programmer often compiles the code into machine language that can be understood by the computer. Scripting languages, which do not require a compiler, use an interpreter to execute the script. A programming language is a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. The term programming language usually refers to high-level languages, Such as BASIC, C, C++, COBOL, Java, FORTRAN, Ada, and Pascal. Generation of Programming Languages There are five generations of Programming languages. They are: First Generation Languages : (M.L.L) These are low-level languages like machine language. Second Generation Languages : (L.L) These are low-level assembly languages used in kernels and hardware drives. Third Generation Languages : (H.L.L) These are high-level languages like C, C++, Java, Visual Basic, and JavaScript. Fourth Generation Languages : These are languages that consist of statements that are similar to statements in the human language. These are used mainly in database programming and scripting. Examples of these languages include Perl, Python, Ruby, SQL, MatLab(MatrixLaboratory). Fifth Generation Languages : These are the programming languages that have visual tools to develop a program. Examples of fifth-generation languages include Mercury, OPS5, and Prolog. The first two generations are called low-level languages. The next three generations are called high-level languages.
  • 2.
    2 | Pa g e
  • 3.
    3 | Pa g e 1. First Generation Language : The first generation languages are also called machine languages/ 1G language. This language is machine-dependent. The machine language statements are written in binary code (0/1 form) because the computer can understand only binary language. Advantages : 1. Fast & efficient as statements are directly written in binary language. 2. No translator is required. Disadvantages : 1. Difficult to learn binary codes. 2. Difficult to understand – both programs & where the error occurred. 2. Second Generation Language : The second-generation languages are also called assembler languages/ 2G languages. Assembly language contains human-readable notations that can be further converted to machine language using an assembler. Assembler – converts assembly level instructions to machine level instructions. Programmers can write the code using symbolic instruction codes that are meaningful abbreviations of mnemonics. It is also known as low-level language. Advantages : 1. It is easier to understand if compared to machine language. 2. Modifications are easy. 3. Correction & location of errors are easy. Disadvantages : 1. Assembler is required. 2. This language is architecture /machine-dependent, with a different instruction set for different machines.
  • 4.
    4 | Pa g e 3. Third Generation Language : The third generation is also called procedural language /3 GL. It consists of the use of a series of English-like words that humans can understand easily, to write instructions. Its also called High-Level Programming Language. For execution, a program in this language needs to be translated into machine language using Compiler/ Interpreter. Examples of this type of language are C, PASCAL, FORTRAN, COBOL, etc. Advantages : 1. Use of English-like words makes it a human-understandable language. 2. Lesser number of lines of code as compared to above 2 languages. 3. Same code can be copied to another machine & executed on that machine by using compiler-specific to that machine. Disadvantages : 1. Compiler/ interpreter is needed. 2. Different compilers are needed for different machines. 4. Fourth Generation Language : The fourth-generation language is also called a non – procedural language/ 4GL. It enables users to access the database. Examples: SQL, Foxpro, Focus, etc. These languages are also human-friendly to understand. Advantages : 1. Easy to understand & learn. 2. Less time required for application creation. 3. It is less prone to errors. Disadvantages : 1. Memory consumption is high. 2. Has poor control over Hardware. 3. Less flexible. 5. Fifth Generation Language : The fifth-generation languages are also called 5GL. It is based on the concept of artificial intelligence(A.I). It uses the concept that rather than solving a problem algorithmically, an application can be built to solve it based on some constraints, i.e., we make computers learn to solve any problem. Parallel Processing & superconductors are used for this type of language to make real artificial intelligence. Example: PROLOG, LISP, etc. Advantages : 1. Machines can make decisions.
  • 5.
    5 | Pa g e 2. Programmer effort reduces to solve a problem. 3. Easier than 3GL or 4GL to learn and use. Disadvantages : 1. Complex and long code. 2. More resources are required & they are expensive too.
  • 6.
    6 | Pa g e C Programming C is a procedural and general-purpose programming language that is used most widely for system programming. Dennis Ritchie initially developed C in between 1972 and 1973 at Bell Labs. American National Standard Institute (ANSI) later formalized this programming language in 1988. The initial purpose of the development of the C programming language was to make utilities of the UNIX based operating system. Directly or indirectly many other computer programming languages have taken/borrowed features from C programming language. Program written in C can be very efficiently mapped to machine instructions which make C programming very much popular to use for any embedded software application development which runs on a microcontroller. C programming is considered as the base for other programming languages, that is why it is known as mother language. It can be defined by the following ways: 1. Mother language 2. System programming language 3. Procedure-oriented programming language 4. Structured programming language 5. Mid-level programming language 1) C as a mother language C language is considered as the mother language of all the modern programming languages because most of the compilers, JVMs, Kernels, etc. are written in C language, and most of the programming languages follow C syntax, for example, C++, Java, C#, etc. It provides the core concepts like the array, strings, functions, file handling, etc. that are being used in many languages like C++, Java, C#, etc.
  • 7.
    7 | Pa g e 2) C as a system programming language A system programming language is used to create system software. C language is a system programming language because it can be used to do low-level programming (for example driver and kernel). It is generally used to create hardware devices, OS, drivers, kernels, etc. For example, Linux kernel is written in C. It can't be used for internet programming like Java, .Net, PHP, etc. 3) C as a procedural language A procedure is known as a function, method, routine, subroutine, etc. A procedural language specifies a series of steps for the program to solve the problem. A procedural language breaks the program into functions, data structures, etc. C is a procedural language. In C, variables and function prototypes must be declared before being used. 4) C as a structured programming language A structured programming language is a subset of the procedural language. Structure means to break a program into parts or blocks so that it may be easy to understand. In the C language, we break the program into small-small modules, each module performs specific task. Each module is defined by using function. It makes the program easier to understand and modify. 5) C as a mid-level programming language C is considered as a middle-level language because it supports the feature of both low- level and high-level languages. C language program is converted into assembly code, it supports pointer arithmetic (low-level), but it is machine independent (a feature of high- level). A Low-level language is specific to one machine, i.e., machine dependent. It is machine dependent, fast to run. But it is not easy to understand. A High-Level language is not specific to one machine, i.e., machine independent. It is easy to understand.
  • 8.
    8 | Pa g e Why do we need to learn C?  C is the most widely and commonly used programming language to develop the different operating systems. The popular operating systems like UNIX and LINUX are written in C.  C program allows programs to maintain portable and compact code along with maintaining performance and minimizing CPU constraints like memory and execution time etc.  C programming language allows programmers to control memory allocation and reallocation which will be very helpful while working with software development for small embedded systems.  C is middle-level language and very fast in terms of execution compared to other programming languages.  Different algorithms and data structures can be implemented using C language very efficiently which can be used in may software applications.  Due to the portability feature of C programming language, the C program written for one computer platform can easily be run on different other platforms with very little modification in code.  Various compilers that are used for other programming languages can be very efficiently designed and developed using the C programming language. Applications of C  To develop and design system software like compilers for other programming languages.  To develop different operating systems for embedded devices and kernels.  To develop graphics related software like gaming application.  To design and develop network device software.  To develop a software system where memory and execution time is constraint like software for microcontrollers which is mainly used for small embedded systems.  Used for systems that require direct access/modification of data from memory.
  • 9.
    9 | Pa g e Uses of programming language ‘C’  Operating Systems: It is used to program Operating systems like Windows, Linux, Mac. Kernel, which is also known as a central part of an OS, is mostly developed in the C language.  Mobile Phone: Mobile phone kernels are also written using this language. So, the smartphones which we have in our hands all the time are running on C kernel.  Mobile Applications: Languages like C++, C#, Objective-C is derived from it and are used to make phone and web applications.  Databases: Many popular databases like MySQL, Oracle Database, MS SQL Server are written using this language.  3D movies, Animation, Computer Graphics: Applications which make 3D movies, Animation, Computer Graphics need to be fast and efficient. Therefore, we code these applications in C, as it is very efficient and fast.  Embedded Systems: Embedded systems like Mp3 player, Alarm clock, radio, microwave, coffee making machine, sensors in the car etc., are coded and programmed in C. Advantages of programming language ‘C’ Below are the advantages:  Portable: Its portability allows code to run on different computers and different operating systems without making any change.  Efficient: It is a general-purpose programming language. Therefore it works efficiently.  Case-sensitive: You need to be very careful while writing the code as it treats lowercase and uppercase letter differently.  Memory Manipulation and allocation: It has the ability to manipulate arbitrary memory addresses. It also allows allocating the memory dynamically.  Middle-level language: It merges the features of both low level and high-level languages in itself. Therefore, it can be used for both: 1. Low-level programming: Like in the development of Kernels 2. High-level programming: Like in the development of applications.  Structured programming language: It is a structured programming language. Therefore, a complex program can be broken into different functions.  Ability to extend itself: Since the library supports it, it allows us to add our own functions to its library.
  • 10.
    10 | Pa g e
  • 11.
    11 | Pa g e Why should we use C Language? We should use this language because of the following reasons:  First, it makes the code size small.  It is efficient, portable, structured and well understood.  It has only 32 keywords which are easy to remember.  It is near to Assembly language as code written in C language runs as fast as code written in assembly language.  It has Pointers that connects hardware like kernel, drivers to a system; because of this reason, C will always be in use.
  • 12.
    12 | Pa g e