Introduction To C Programming-Unit1-Part1
Introduction To C Programming-Unit1-Part1
programming
ESU104E
Dr. Kavitha Devi CS
2
What is C?
Why Learn C?
It is one of the most popular programming
languages in the world
1. Engineering knowledge
2. Problem analysis
3. Design/development of
solutions
4. Conduct investigations
of complex problems
5. Modern tool usage
10
2. Educational software
4. Productivity software
6. Computer games
15
2. System software :
provides a general programming environment
in which programmers can create specific
application to suit their needs.
This environment provides new functions that
are not available at the hardware level and
performs tasks related to application software.
It acts as an interface between the hardware
and application software.
Fig 6.2 illustrates the relationship between
application software and system software.
And Table 6.1 lists the difference between
application software and system software.
19
20
21
The BIOS screen is shown in Fig 6.3, This menu enables the
user to configure hardware
Set the system clock
Enable/Disable system components
24
2. Operating System 𝑶𝑺
The primary goal of OS is to make the computer system or
cell phone convenient and efficient to use.
3. Utility Software
Utility software is used to analyze, configure, optimize and
maintain the computer system. Utility programs may be
requested by application program during their execution for
multiple purposes. Examples
1. Disk defragmenters
2. Disk checkers
3. Disk cleaners
4. Disk space analyzers
5. Disk partitions
6. Backup utilities
7. Disk compression
8. File managers
9. System profilers
10. Anti virus utilities
11. Data compression utilities
12. Cryptographic utilities
13. Launcher applications
14. Registry cleaners
15. Network utilities
16. Command line interface 𝑪𝑳𝑰 and graphical user interface 𝑮𝑼𝑰
27
1. Disk defragmenters – are used to detect computer files whose contents are broken
across several locations on the hard disk, and its fragments can be moved to one
location in order to increase efficiency.
2. Disk checkers – are used to scan the contents of a hard disk to find files that are either
corrupt in some way, or not correctly saved and eliminate/repair them in order to
make the hard derive operate more efficiently.
3. Disk cleaners – helps the user to decide what to delete when their hard disk is full.
4. Disk space analyzers – are used for visualizing disk space usage by obtaining the size
of all folders and files in the folder or drive.
5. Disk partitions – are used to divide an individual derive into multiple logical derives,
each with its own file system.
6. Backup utilities – are used to make a copy of all information stored on a disk. In case
a disk failure occurs, backup utilities are used to restore the entire disk. Even if a file gets
deleted accidently, the backup utility can be used to restore the deleted files
7. Disk compression – are used to enhance the capacity of the disk by compressing the
contents of the disk.
8. File managers – are used to provide routine data management tasks performance
conveniently like deleting, renaming, cataloguing, moving, copying, merging etc.
28
10. Antivirus – utilities are used to scan the computer for viruses.
11. Data Compression – utilities are used to compress files to smaller size.
14. Registry Cleaners – are used to clean and optimize the windows registry by
deleting old registry keys that are no longer in use.
15. Network Utilities – are used to analyze the computer’s network connectivity,
configure network settings and check data transfer or log events.
16. Command line interface 𝑪𝑳𝑰 and graphical user interface 𝑮𝑼𝑰 - are
used to interface the OS with other software.
29
4. Translators :
Translators are computer programs used to translate a code written in one
programming language to a code in another language that computer can
understand.
Types :
1. Compilers,
2. Interpreter
3. Assembler.
If the source code contains errors, then the compiler will not be able do its task. The
errors will limit it in understanding a program called as Syntax Error.
Another type of error is the logical error, which occurs when a program dies not
function accurately and its much harder to identify and correct.
30
#include <stdio.h>
int main()
{ int x=3;
int y=6;
int sum;
sum = x+y;
printf("integer1=%d", x, "\n");
printf("integer2=%d", y, "\n");
printf("integer3=%d", sum, "\n" );
return 0;
}
32
#include <stdio.h>
int main()
{
int x=3;
int y=6;
int sum, Diff, Mul, Div ;
Sum = x+y;
Diff = x-y;
Mul = x*y;
Div= x/y;
printf("num1=%d", x, "\n");
printf(" num2=%d", y, "\n");
printf(" sum=%d, Diff=%d, Mul=%d, Div=%d", sum, Diff, Mul, Div, "\n" );
return 0;
}
33
They also allow them to stop on specific point at which they can
examine the value of certain variables.
36
3. Programming Languages
A programming language is a language specifically designed to
express computations that can be performed using the computer.
While high level languages are easy for humans to read and
understand but the computer can only understand the machine
language consisting of only numbers i.e. zeros and ones.
Different type of central processing unit (CPU) has its own unique
machine language.
In between the machine language and high level language there is
another type of language known as assembly language, they are
much easier to program.
This is the lowest level of programming language and also the only language
that computers understand.
All the commands and data values are expressed using 1’s and 0’s it
corresponds to ‘on’ and ‘off ‘ of electrical states in computer
Although this language programs are typically displayed with the binary
numbers represented in octal (base 8) or hexadecimal (base 16 ) and these
programs are not easy for humans to read, write and debug.
The main advantage of machine language is that the code can be executed
very quickly and efficiently, since it is directly executed by CPU.
And more difficult to learn & far more difficult to correct if errors occur.
Lastly the code written in machine language is not portable and transferable to
a different computer. Because it needs to be completely rewritten since the
machine language for one computer could be significantly different from that
of another.
43
Here also the language will vary from machine to machine, because
it is related to the internal architecture of the computer.
For example, when working with structured query language (SQL) the
programmer just needs to remember a few rules of syntax and logic,
but it is much easier to learn than COBOL OR C.
Hence, we can see that 4GL is much simpler to learn and work with.
The same code, if written in C language or any other 3GL, would
require multiple lines of code to do the same task.
Hence, taking a forward leap from 4GLs, 5GLs are designed to make
the computer solve a given problem without the programmer.