Subject Name: Programming For Problem Solving Subject Code: ESC 103 Introduction To C
Subject Name: Programming For Problem Solving Subject Code: ESC 103 Introduction To C
Subject Name: Programming For Problem Solving Subject Code: ESC 103 Introduction To C
Introduction to C
C is a programming language developed at AT & T’s Bell Laboratories of USA
in 1972.
In the late seventies C began to replace the more familiar languages of that time
like PL/I, ALGOL, etc
ANSI C standard emerged in the early 1980s, this book was split into two
titles: The original was still called Programming in C, and the title that covered
ANSI C was called Programming in ANSI C.
This was done because it took several years for the compiler vendors to
release their ANSI C compilers and for them to become ubiquitous.
It was initially designed for programming UNIX operating system. Now the
software tool as well as the C compiler is written in C.
Major parts of popular operating systems like Windows, UNIX, Linux is still
written in C.
Compiler
Interpreter
Assembler
Compiler and interpreter are used to convert the high-level language into
machine level language. The program written in high level language is known as
source program and the corresponding machine level language program is called
as object program. Both compiler and interpreter perform the same task but there
working is different. Compiler read the program at-a-time and searches the error
and lists them. If the program is error free then it is converted into object program.
When program size is large then compiler is preferred. Whereas interpreter read
only one line of the source code and convert it to object code. If it checks error,
statement by statement and hence of take more time.
An assembler is a program that takes basic computer instructions and converts them into a
pattern of bits that the computer's processor can use to perform its basic operations. Some
people call these instructions assembler language and others use the term assembly language.
The Assembler is a Software that converts an assembly language code to machine code. It takes
basic Computer commands and converts them into Binary Code that Computer's Processor can use to
perform its Basic Operations.
Integrated Development Environments (IDE)
On Mac OS X, CodeWarrior and Xcode are two IDEs that are used by many
programmers. Under Windows, Microsoft Visual Studio is a good example of a
popular IDE. Kylix is a popular IDE for developing applications under Linux.
Most IDEs also support program development in several different programming
languages in addition to C, such as C# and C++.
What is Programming?
Computer programming is a medium for us to communicate with computers, just like we use Hindi or English
to communicate with each other. Programming is a way for us to deliver our instructions to the computer.
What is C?
C is a programming language. C is one of the oldest and finest programming languages. C was developed by
Dennis Ritchie in 1972.
Uses of C
C is a language that is used to program a wide variety of systems. Some of the uses of C are as follows:
1. Major parts of Windows, Linux, and other operating systems are written in C.
2. C is used to write driver programs for devices like Tablets, Printers, etc.
3. C language is used to program embedded systems where programs need to run faster in limited
memory.
4. C is used to develop games, an area where latency is very important, i.e., a computer has to react
quickly to user input.
Lecture Note: 2
1 ) Comment line
2) Preprocessor directive
4) main function( )
Local variables;
Statements;
Comment line
/*……………………………..*/
// Comment line is used for increasing the readability of the program.
It is useful in explaining the program and generally used for documentation.
Comment line can be single or multiple line but should not be nested.
10
It can be anywhere in the program except inside string constant & character
constant.
Preprocessor Directive:
Global Declaration:
This is the section where variable are declared globally so that it can be access by
all the functions used in the program. And it is generally declared outside the
function :
main()
It is the user defined function and every function has one main() function from
where actually program is started and it is encloses within the pair of curly braces.
The main( ) function can be anywhere in the program but in general practice it is
placed in the first position.
Syntax :
main()
……..
……..
}
11
The main( ) function return value when it declared by data type as
int main( )
return 0
12
}
The main function does not return any value when void (means
Output: C language
The program execution start with opening braces and end with closing
brace.
13