Ch01-Introduction-To-Cprogramming Language
Ch01-Introduction-To-Cprogramming Language
System software
C programming Language 3
Application software
C programming Language 4
Overview of Computer Programming
Languages
A programming language is a standardized communication
technique for expressing
instructions to a computer. Like human languages, each
language has its own syntax and grammar.
Categories of Programming Languages
1. High-level Programming Languages
2. Low-level Assembly Language
3. Middle Level Languages
C programming Language 5
1. High-level Programming Languages
C programming Language 6
Low-level Assembly Language
C programming Language 7
Early programming language
C programming Language 8
Later Programming Languages
C programming Language 9
Overview of C programming Language
C programming Language 10
Overview of C programming Language…
In 1978, Brian Kernighan and Dennis Ritchie produced the
first publicly available description of C, now known as the
K&R standard.
C programming Language 11
Overview of C programming Language …
The UNIX operating system, the C compiler, and essentially
all UNIX applications programs have been written in C. The
C has now become a widely used professional language for
various reasons.
Easy to learn
Structured language
It produces efficient programs.
It can handle low-level activities.
It can be compiled on a variety of computer platforms.
C programming Language 12
The History of C programming
C was invented to write an operating system called UNIX.
C is a successor of B language, which was introduced around
1970.
The language was formalized in 1988 by the American
National Standard Institute (ANSI).
The UNIX OS was totally written in C by 1973.
Today, C is the most widely used and popular System
Programming Language.
Most of the state-of-the-art softwares have been implemented
using C.
Today's most popular Linux OS and RBDMS MySQL have
been written in C.
C programming Language 13
Why to Use C program ?
C was initially used for system development work, in
particular the programs that make up the operating
system.
C was adopted as a system development language
because it produces code that runs nearly as fast as
code written in assembly language.
Therefore, those are convincing reasons why one
should adopt C as the first and the very important step
in your quest for learning programming languages.
C programming Language 14
Why to Use C program ?...
Some examples of the use of C might be:
Operating Systems
Language Compilers
Assemblers
Text Editors
Print Spoolers
Network Drivers
Modern Programs
Databases, Language Interpreters and Utilities 15
Getting Started with C programming
Communicating with a computer involves speaking the
language the computer understands, which immediately
rules out English as the language of communication with
computer.
However, there is a close analogy between learning English
language and learning C language.
Like the classical method of learning English using the
alphabets used in the language, Learning C is similar and
easier.
Instead of straight-away learning how to write programs, we
must first know what alphabets, numbers and special
symbols are used in C
C programming Language 16
C Environment Setup
This section describes how to set up your system
environment before you start doing your programming
using C language.
C programming Language 18
The C Compiler
The source code written in source file is the human readable
source for your program. It needs to be "compiled", to turn
into machine language so that your CPU can actually
execute the program as per instructions given.
This C programming language compiler will be used to
compile your source code into final executable program.
Al thought, there are several C compilers, in this course, we
will use one program called “DEV C++ “ which has combined
the text editor and C compiler
C programming Language 19
C Program Structure
Before we study basic building blocks of the C programming
language, let us look a bare minimum C program structure
so that we can take it as a reference in upcoming chapters.
C programming Language 20
C Program Structure
A C program basically consists of the following parts:
Preprocessor Commands
Functions
Variables
Statements
& Expressions
Comments
C programming Language 21
C Hello World Example
C programming Language 22
C Hello World Example
C programming Language 23
Compile & Execute C Program
Let’s look at how to save the source code in a file, and
how to compile and run it. Following are the simple steps:
1. Open a DEV C+ + and add the above-mentioned
code.
2. Save the file as hello.c
C programming Language 24
Compile & Execute C Program …
5. If there are no errors & warnings in your code, we t will
go to the next step which is to run the program.
C programming Language 25
Compile & Execute C Program …
26
C Basic Syntax
You have seen a basic structure of C program, so it will be
easy to understand other basic building blocks of the C
programming language.
Tokens in C
A C program consists of various tokens and a token is
either a keyword, an identifier, a constant, a string literal, or
a symbol. For example, the following C statement consists
of five tokens:
27
Semicolons ;
In C program, the semicolon is a statement terminator.
That is, each individual statement must be ended with a
semicolon.
It indicates the end of one logical entity.
For example, following are two different statements:
28
Comments
Comments are like helping text in your C program and they
are ignored by the compiler.
They start with /* and terminates with the characters */ as
shown below:
29
Summary
C programming Language 30
Thank you
Q&A