1.
NAME: JOHN JOSEPH
COURSE: CSC 202
COURSE TITLE : COMP PROGRAMMING II
MATRIC NO: U23MTH1020
DEPARTMENT: MATHEMATICS
GMAIL: JOSEPH.J222B@GMAIL.COM
Page content
Abstract
1. Introduction
2. Programming language (generation types and where c falls in)
3. Programming paradise (types, where c falls in)
4. C programming language
5. Conclusion
Abstract
C Programming Language
C is a general-purpose procedural programming language initially developed
by Dennis Ritchie between 1969 and 1973 while at AT&T Bell Labs. Unlike
python, or java, C is a low level language and it’s considered the mother of
all programming languages
Programming language (generation, types, and, where c falls in)
Computer Language 1. First Generation Language:-
The first generation languages , or 1 GL are low-level languages that are
machine language. Originally, no translator was used to compile or assemble
the first-generation language. The first-generation programming instructions
were entered through the front panel switches of the computer system. The
main benefit of programming in a first-generation programming language is
that the code a user writes can run very fast and efficiently, since it is
directly executed by the CPU.
2. Second Generation Language:-
The second generation languages , or 2 GL are also low-level languages that
generally consist of assembly languages. The term was coined to provide a
distinction from higher level third-generation programming languages (3 GL)
such as COBOL and earlier machine code languages. Second-generation
programming languages have the following properties: The code can be
read and written by a programmer. To run on a computer it must be
converted into a machine readable form, a process called assembly. The
language is specific to a particular processor family and environment
3. Third Generation Language:-
The third generation languages, or 3 GL
are high-level languages such as C. Most popular general-purpose languages
today, such as C++, C#, Java, BASIC and Delphi,are also third-generation
languages. Most 3. GLs support structured programming.
4. Fourth Generation Language:-
The fourth generation languages, or 4 GL
are languages that consist of statements similar to statements in a human
language. Fourth generation languages are commonly used in database
programming and scripts.
A fourth-generation programming language (1970s-1990) (abbreviated
4 GL) is a programming language or programming environment designed
with a specific purpose in mind, such as the development of commercial
business software. In the history of computer science, the 4 GL followed the
3 GL in an upward trend toward higher abstraction and statement power. The
4 GL was followed by efforts to define and use a 5 GL.
5. Fifth Generation Language:-
The
fifth generation languages, or 5 GL
are programming languages that contain visual tools to help develop a
program. A good example of a fifth generation language is Visual Basic.
A fifth-generation programming language
(abbreviated 5 GL) is a programming language based around solving
problems using constraints given to the program, rather than using an
algorithm written by a programmer. Most constraint-based and logic
programming languages and some declarative languages are fifth-generation
languages.
4.2 – What is C Programming?
C programming is a high-level general-purpose programming language
widely used for developing various applications and embedded systems.
Many other modern programming languages have been derived from it.
4.4- Basics of C Language: Features Highlights
Some of the crucial features of C programming are mentioned below.
C is a procedural language that follows a step-by-step procedure to solve a
problem.
It is also known as a mid-level programming language as it combines the
features of high-level as well as low-level languages.
It allows developers to break the code into smaller modules or functions that
can be reused and maintained.
It is a statically typed language, which means a type of variable can be
determined during compilation.
It provides library support consisting of predefined functions.
C programming languages are portable and can be used on different
machines without any changes.
It supports recursion, bit manipulation, multithreading, and more to provide
faster execution and efficiency.
Basics of C Language: Identifiers
Identifiers are the name given to a variable which is used to identify the
variable, function or any other user-defined elements in the code.
An identifier can begin with lowercase or uppercase alphabet, underscore, or
numbers and alphabet combinations.
It does not allow punctuation or special symbols, such as @, $, %, etc in the
identifiers.
It is a case-sensitive programming language.
Basic of C Language: Constants
Constants are fixed values which cannot be changed or modified after
initialisation. These fixed values are also referred to as literals. It can be of
any data type, such as integer, float, pointer, string, character, etc. In C
programming language, it is represented using const keyword.
4.5- Basics of C Language
const int maxNumber = 100;
const double PI = 3.1459;
const char Greeting = “Hello World”;
4.6- Basics of C Language: Keywords
Keywords are reserved words with specific defined functions. It cannot be
used as a variable name or function name. In C programming language,
there are 32 keywords.
Keywords in C Programming Language
autovoid
elsecontinue
longgoto
switchsizeof
breakvolatile
enumdefault
registerif
typedefstatic
casewhile
externdo
returnint
unionstruct
charpack
floatconst
shortfor
unsignedsigned
4.7- Basic of C Language: Comments
Comments are part of the program that is not compiled or executed. The
comments are the text written along with the code to provide an explanation
or guidance to any reader or developer going through the code. The compiler
ignores these comments while executing the program.
C Program supports single-line comments which begin with “//” at the end of
the comment. For multi-line comments which are enclosed between “/*” and
“*/”. Comments increase the readability of the code.
4.8- Basic of C Langauge: Data Types
C Program supports various data types to store values inside the variable.
There are three major types of data used in C Programming Language.
1. Primary or Primitive Data Type
It consists of the most basic type of data represented using integers, float,
characters, double floating points, voids, etc.
2. User Defined Data Type
C Program also supports user-defined data types such as class, union, enum,
typedef, class, etc. Different data types have different ranges which vary
across compilers.
3. Derived Types
These data types are derived from the primitive data types and are hence
known as derived data types. For example, function, array, pointer,
reference, etc.
4.9- Basics of C Langauge: Statement Terminator
In C programming we use semicolons to end a statement. Each program
statement in C ends with a semicolon. Check with an example below.
Basics of C Language
const int maxNumber = 100;
const double PI = 3.1459;
const char Greeting = “Hello World”;
5.0- Why Learn C Programming?
C programming is important for several reasons. Some of which are
highlighted below.
C program is a high-level language that is comparatively easier to learn.
C programming language, being the mother of all other programming
languages, provides a good hold over the basics of programming.
It is used to develop operating systems, embedded systems and gaming
applications, which are always in higher demand.
C Programming language is a portable language that can easily run on
different platforms without any changes being required.
C is a procedural language, which means it follows a set of guidelines to form
programs.
It is a compiled language as code is first compiled and then executed.
Basics of C Langauge: Hello World Program
Start your C programming with the “Hello World!” program in the table
below.
Basics of C Language: Hello World!
#include <stdio.h> // Include standard input/output library
int main() {
// Print “Hello, world!” on the console
printf(“Hello, world!\n”);
return 0; // Return 0 to indicate successful execution
Output
C++ with DSA on PW Skills
If you want to start your career in programming then C++ program is the
best option to start learning programming. C++ is an extension of C
programming language which is more user-friendly and powerful. Enrol in our
Decode C++ with DSA Course to learn with interactive classes and hands-on
learning experience.
Basics of C Language FAQs
What is Algorithm in C?
An algorithm is a step-by-step procedure to solve a problem in C
programming. It creates a machine-friendly solution which can be executed
with simple C programs.
Reference:
Online resource; PW Skills
7.WHAT IS A COMPILED LANGUAGE, IS C ONE?
in any target environment in order for applications packaged and deployed
as bytecode to run.
The benefit of applications built with an interpreted language is that they can
run on any environment. In fact, one of the mantras of the Java language
when it was first released was “Write once, run anywhere,” as Java apps
were not tied to any one OS or architecture.
The drawback to an interpreted language is that the interpretation step
consumes additional clock cycles, especially in comparison to applications
packaged and deployed as machine code.
age as a purely compiled one.
Reference:
Online resource PW Skills
8.WHILE, DO..WHILE LOOPS IN C
Loop in C with Examples: While, Do..While Loops
What are Loop in C?
Loops are a block of code that executes itself until the specified condition
becomes false. In this section, we will look in detail at the types of loops used
in C programming.
What is the Need for Looping Statements in C?
Here are some uses of loops in C:
Loops allow the user to execute the same set of statements repeatedly
without writing the same code multiple times.
It saves time and effort and increases the efficiency.
It reduces the chance of getting errors during compilation.
Loop makes the code readable and easier to understand, especially when
dealing with complex logic or large data sets.
It promotes code reusability.
Loops help traverse data structures like arrays or linked lists
Types of Loop in C
Let’s get into the three types of loops used in C programming.
for loop
while loop
do while loop
for loop in C
A for loop is a control structure that enables a set of instructions to get
executed for a specified number of iterations. It is an entry-controlled loop.
for loop Flowchart
for loop in C
Syntax
for(initialization; test condition; update expression){
//code to be executed
Here, the initialization statement is executed first and only once.
The test condition is checked, if false the loop terminates
If the test condition is true, the body of the loop executes
The update expression gets updated
Again the test condition is evaluated
The process repeats until the test condition becomes false.
Example: For loop in C Compiler
// Program to print numbers from 1 to 10
#include <stdio.h>
int main() {
int I;
for (I = 0; I < 10; i++)
printf(“%d\n”, i+1);
}
return 0;
Run Code >>
The above code prints the numbers from 1 to 10 using a for loop in C.
We know it will take 10 iterations to print 10 numbers so, we have used the
for loop.
I is initialized to 0.
The condition i<10 will be checked. It is true, therefore i+1 i.e. 1 gets
printed.
Then I increments to 1 again the condition, i<10 is evaluated.
The process will repeat until I become 10.
Output
10
while loop in C
It repeatedly carries out a series of instructions till a condition is true. It is an
entry-controlled loop. The while loop in C is used when we don’t know the
number of iterations.
while loop Flowchart
while loop in c programming
Syntax
while(test condition){
//code to be executed
If the test condition inside the () becomes true, the body of the loop executes
else loop terminates without execution. The process repeats until the test
condition becomes false.
Example: while loop in C
// Print numbers from 1 to 10
#include <stdio.h>
int main()
int I = 1;
while (I <= 10) {
printf(“%d\n”, i);
i++;
return 0;
Run Code >>
In the above code, I is initialized to 1 before the start of the loop.
The test condition, i<=10 is evaluated. If true, the body of the loop executes.
If the condition becomes false in the beginning itself, the program control
does not even enter the loop once.
The loop executes until I becomes 10.
Output
10
do…while loop in C
It is an exit-controlled loop. It prints the output at least once before checking
the condition. Afterwards, the condition is checked and the execution of the
loop begins.
do…while loop Flowchart
Syntax
do{
//code to be executed
}while(test condition);
The body of the loop executes before checking the condition.
If the test condition is true, the loop body executes again.
Again the test condition is evaluated.
The process repeats until the test condition becomes false.
Example: do…while loop in C
#include <stdio.h>
int main()
int I = 0;
do {
printf(“%d\n”, i+1);
i++;
while (I < 10);
return 0;
Run Code >>
The above code prints numbers from 1 to 10 using the do while loop in C.
It prints 1 before checking if I less than 10.
It checks the condition i<10 and executes until I becomes 10
Output
10
Summary
Loops in C have a broad range of applications, from loop-driven algorithms to
iterative problem-solving. As demonstrated, the syntax for using these loops
is relatively straightforward, although their logic must be carefully explored
to determine advantage and ease of use.
Referenc:
PW Skills
9.Conclusion
C programming is a versatile and powerful language that has played a
significant role in shaping the world of computer programming.
C programming is a high-level programming language that is known for its
efficiency, portability, and flexibility. It is often referred to as the “mother of
programming language”, a middle-level language because it combines
elements of both high-level and low-level languages. C has influenced the
development of many other programming languages, including C++, Java,
and Python.
At its core, C is a procedural programming language.
Features of C Programming
C programming possesses several notable features that have contributed to
its enduring popularity:
Portability
Efficiency
Flexibility
Rich Standard Library
Community Support
C programming is a versatile and powerful language with a rich history and
enduring popularity. Its efficiency, portability, and flexibility make it suitable
for a wide range of applications, from system software to game development
and scientific computing.
Understanding C programming is a valuable skill for both beginners and
experienced programmers, as it provides a solid foundation for mastering
other programming languages and tackling complex software development
challenges. In the world of programming, C continues to be a fundamental
building block that has stood the test of time.
12. All Article’s Reference:
Reference: Ritchie, D. M. (1973). The C Programming Language ( The First
Edition).
Author: Sebesta
Tittle: Concepts of Language
Reference
Sebesta, R. W. (2019).
Tittle: Concepts of programming Languages
Edition: 12
Reference
PW skills