SlideShare a Scribd company logo
Introduction to ‘C’
Compiled By :
Abhishek Sinha (MBA-IT, MCA)
Director – Academics
Concept Institute of Technology, Varanasi.
Website: www.conceptvns.org
What is C ? - Programming Language
 Language is a medium of communication. It
is a system for encoding & decoding
information.
 Program is a set of instructions to be
followed in a particular fashion to
accomplish a particular task.
 Programming is a process to develop a
program
A Programming Language is an
artificial language designed to express
computations that can be performed
by a machine, particularly a
computer.
Brief Introduction of C
 C is a programming language that follows the
philosophy of POP (Procedural Oriented
Programming) categorized under High Level
Language (some times under Middle Level
Language).
 Developed by “Dennis Ritchie” in the year
1972 at AT & T Bell Laboratory, USA.
 It uses Compiler as a language translator to
convert C instruction to executable code.
Historical Development of C
Year Language Developer Remarks
1960 ALGOL International
Committee
Too general,
too abstract
1963 CPL Cambridge
University
Hard to learn,
difficult to implement
1967 BCPL Martin Richards,
Cambridge
University
Could deal with only
specific problems
1970 B Ken Thompson,
AT & T
Could deal with only
specific problems
1972 C Dennis Ritchie,
AT & T
Lost generality of
BCPL & B restored
ALGOL : Algorithmic Language
CPL : Combined Programming Language
BCPL : Basic Combined Programming Language
Basic Building Blocks
 Variables: ‘the values which can be changed
or changes itself’, e.g. salary, age, time etc..
 Constants: ‘the values which neither can be
changed nor changes itself’, e.g. PIE,
G(gravitational constant), g (gravitational
acceleration) etc..
 Identifiers: ‘it is the name given to a value
by which we can identify whether it is a
variable or a constant’
 Keywords: ‘reserved words whose meaning
is predefined to the complier & whenever
compiler comes across those words, it does
the appropriate task’. 32 reserved words are
there in C such as goto, break, continue,
return, void etc..
 Operators: are the special symbols which
when applied on operands, gives us some
manipulated result, and result depends on
type of operator applied.
 Operator Types:
Can be categorized on the basis of two criteria's:
a) No of Operands
b) Operation Performed
• Unary Operator (1 operand)
• Binary Operator (2 operand)
• Ternary Operator (3 operand)
• Arithmetic Operator (+, -, *, /, %)
• Assignment Operator (=)
• Relational Operator (<, <=, ==, >, >=, !=)
• Logical Operator (&&, ||, !)
• Conditional Operator ( ? :)
• Increment/Decrement Operator (++, --)
• Bitwise Operator (&, |, ~, ^, <<, >>)
• Some Special Operators ( [], (), *, ., ->,
malloc, calloc, realloc, sizeof, free)
 Data Type: Tells us about three facts that a
programmer must know and is very
important:
• Type of value we can work on C Language
• Memory space required to store that value
(size depends on Operating System)
• Range of value it can store in that space
Making the use of these facts programmer
reserves the space for its data accordingly.
We can categorize Data Type in two flavors
•Primary Data Type
•Numeric
•Integer
•Short
•Signed
•Unsigned
•Long
•Real
•Float
•Double
•Long Double
•Non Numeric
•Character
•Signed
•Unsigned
•String (implemented as array)
•Secondary Data Type
•Derived Data Type
•Array
•Pointer
•Function
•User Defined Data Type
•Structure
•Union
•Enum
*At this stage our concern topic is Primary Data Type
Integer – denoted as int – by default it is signed int
Type Size (in bytes) Range Format String
short int 2 -32768 to +32767 %d
signed int 2 -32768 to +32767 %d
unsigned int 2 0 to 65535 %u
long int 4 -2147483648 to +2147483647 %ld
Real
Type Size (in bytes) Range Format String
float 4 3.4e-38 to 3.4e+38 %f
double 4 1.7e-308 to 1.7e+308 %lf
long double 8 3.4e-4932 to 3.4e+4932 %le
Character – denoted as char – by default it is signed char
Type Size (in bytes) Range Format String
signed char 1 -128 to +127 %c
unsigned char 1 0 to 255 %c
 Variable Declaration: A process to reserve
space in memory for data values, where
those space are identified by the name of
the variable for further reference.
Syntax: <data_type> <variable_name>;
Example: int age; // by default takes signed int
This very statement makes the compiler to reserve
two byte of space in memory and identifies it with the
name age.
age name of location
location in memory
102 base address of location
MEMORY REPRESENTATION
 Variable Initialization: A process to assign
initial value to a variable at the time of
declaration. By default it takes garbage
value (depends on storage class specifier)
Syntax:
<data_type> <variable_name> = <initial_value>;
Example: int age = 10;
This very statement makes the compiler to reserve
two byte of space in memory and identifies it with the
name age and assigns 10 as its initial value.
age name of location
location in memory
102 base address of location
MEMORY REPRESENTATION
10
C Program Structure
Statements Example
1. Documentation / Commnet Section /*Sample Program*/
2. Header File Inclusion #include<stdio.h>
3. Macro Definition #define MAX 10
4. Global Variable Declaration int x;
5. Sub-function(s) <RT> <Function Name>(<AL>)
{
//body of function
}
6. Main function main()
{
//body of main
}
Compilation Process
Source code (.c) Object code (.obj)
Expanded code (.i )
Assembly code (.asm) Executable code (.exe)
Pre-Processing
Compiling
Assembling
Linking & Loading
Making
First of all we make our source file with an
extension .c, now the code is expanded based on
Preprocessor Directives used and is stored in a
file having .i extension. From this code compiler
checks for syntax errors. If it is error free,
compiler converts it to the assembly language of
the machine being used. This is stored in file
having .asm extension. Now the assembler
creates .obj file. Then linking and loading
software makes the link with other files if
included in source code and those files are
loaded in memory. Now the making process
creates .exe file which is executed/run and gives
our output. Meanwhile at back scene another
file is created having .bak extension which keeps
the back-up of source code.
END OF CHAPTER ONE
Send your feedback/queries at
abhisheksinha786@gmail.com

More Related Content

PPSX
Concepts of C [Module 2]
PPT
Input And Output
PPTX
What is c
PPTX
Basic Input and Output
PPT
Mesics lecture 5 input – output in ‘c’
PPTX
Input Output Management In C Programming
PDF
C programming Workshop
PDF
7. input and output functions
Concepts of C [Module 2]
Input And Output
What is c
Basic Input and Output
Mesics lecture 5 input – output in ‘c’
Input Output Management In C Programming
C programming Workshop
7. input and output functions

What's hot (20)

PPTX
Data Input and Output
PPT
CPU INPUT OUTPUT
PPTX
Managing input and output operations in c
PPTX
Introduction to Basic C programming 02
PPTX
Introduction to C programming
PPTX
Input output statement in C
PPTX
C programming(Part 1)
PDF
7 functions
PDF
1 introducing c language
DOCX
Important C program of Balagurusamy Book
PPTX
Programming in C (part 2)
PPTX
C introduction by thooyavan
PPTX
C Programming Language Part 6
PPTX
C programming(part 3)
PDF
4 operators, expressions &amp; statements
PPTX
Decision making and branching
PPTX
Expressions using operator in c
DOCX
UNIT-II CP DOC.docx
Data Input and Output
CPU INPUT OUTPUT
Managing input and output operations in c
Introduction to Basic C programming 02
Introduction to C programming
Input output statement in C
C programming(Part 1)
7 functions
1 introducing c language
Important C program of Balagurusamy Book
Programming in C (part 2)
C introduction by thooyavan
C Programming Language Part 6
C programming(part 3)
4 operators, expressions &amp; statements
Decision making and branching
Expressions using operator in c
UNIT-II CP DOC.docx
Ad

Similar to Programming in C [Module One] (20)

PPT
C material
PDF
Module_1_Introduction-to-Problem-Solving.pdf
PPTX
Intro in understanding to C programming .pptx
PPTX
Intro in understanding to C programming .pptx
PDF
Chap 2 c++
PPTX
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
PPTX
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
PPTX
Data Type in C Programming
PPTX
PPTX
Presentation c++
PPTX
Fundamentals of computers - C Programming
PPSX
Lecture 2
PDF
C programming introduction for beginners.pdf
DOCX
C tutorials
PPTX
C programming language
PPTX
#Code2 create c++ for beginners
PDF
Learn c language Important topics ( Easy & Logical, & smart way of learning)
DOCX
C notes
PPTX
introductory concepts
PPTX
Fundamentals of Data Structures Unit 1.pptx
C material
Module_1_Introduction-to-Problem-Solving.pdf
Intro in understanding to C programming .pptx
Intro in understanding to C programming .pptx
Chap 2 c++
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
Data Type in C Programming
Presentation c++
Fundamentals of computers - C Programming
Lecture 2
C programming introduction for beginners.pdf
C tutorials
C programming language
#Code2 create c++ for beginners
Learn c language Important topics ( Easy & Logical, & smart way of learning)
C notes
introductory concepts
Fundamentals of Data Structures Unit 1.pptx
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Cell Types and Its function , kingdom of life
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
master seminar digital applications in india
PDF
Complications of Minimal Access Surgery at WLH
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Lesson notes of climatology university.
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Cell Types and Its function , kingdom of life
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GDM (1) (1).pptx small presentation for students
master seminar digital applications in india
Complications of Minimal Access Surgery at WLH
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
human mycosis Human fungal infections are called human mycosis..pptx
Lesson notes of climatology university.
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
A systematic review of self-coping strategies used by university students to ...
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Anesthesia in Laparoscopic Surgery in India
Chinmaya Tiranga quiz Grand Finale.pdf
Weekly quiz Compilation Jan -July 25.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx

Programming in C [Module One]

  • 1. Introduction to ‘C’ Compiled By : Abhishek Sinha (MBA-IT, MCA) Director – Academics Concept Institute of Technology, Varanasi. Website: www.conceptvns.org
  • 2. What is C ? - Programming Language  Language is a medium of communication. It is a system for encoding & decoding information.  Program is a set of instructions to be followed in a particular fashion to accomplish a particular task.  Programming is a process to develop a program
  • 3. A Programming Language is an artificial language designed to express computations that can be performed by a machine, particularly a computer.
  • 4. Brief Introduction of C  C is a programming language that follows the philosophy of POP (Procedural Oriented Programming) categorized under High Level Language (some times under Middle Level Language).  Developed by “Dennis Ritchie” in the year 1972 at AT & T Bell Laboratory, USA.  It uses Compiler as a language translator to convert C instruction to executable code.
  • 5. Historical Development of C Year Language Developer Remarks 1960 ALGOL International Committee Too general, too abstract 1963 CPL Cambridge University Hard to learn, difficult to implement 1967 BCPL Martin Richards, Cambridge University Could deal with only specific problems 1970 B Ken Thompson, AT & T Could deal with only specific problems 1972 C Dennis Ritchie, AT & T Lost generality of BCPL & B restored ALGOL : Algorithmic Language CPL : Combined Programming Language BCPL : Basic Combined Programming Language
  • 6. Basic Building Blocks  Variables: ‘the values which can be changed or changes itself’, e.g. salary, age, time etc..  Constants: ‘the values which neither can be changed nor changes itself’, e.g. PIE, G(gravitational constant), g (gravitational acceleration) etc..  Identifiers: ‘it is the name given to a value by which we can identify whether it is a variable or a constant’
  • 7.  Keywords: ‘reserved words whose meaning is predefined to the complier & whenever compiler comes across those words, it does the appropriate task’. 32 reserved words are there in C such as goto, break, continue, return, void etc..  Operators: are the special symbols which when applied on operands, gives us some manipulated result, and result depends on type of operator applied.
  • 8.  Operator Types: Can be categorized on the basis of two criteria's: a) No of Operands b) Operation Performed • Unary Operator (1 operand) • Binary Operator (2 operand) • Ternary Operator (3 operand) • Arithmetic Operator (+, -, *, /, %) • Assignment Operator (=) • Relational Operator (<, <=, ==, >, >=, !=) • Logical Operator (&&, ||, !) • Conditional Operator ( ? :) • Increment/Decrement Operator (++, --) • Bitwise Operator (&, |, ~, ^, <<, >>) • Some Special Operators ( [], (), *, ., ->, malloc, calloc, realloc, sizeof, free)
  • 9.  Data Type: Tells us about three facts that a programmer must know and is very important: • Type of value we can work on C Language • Memory space required to store that value (size depends on Operating System) • Range of value it can store in that space Making the use of these facts programmer reserves the space for its data accordingly.
  • 10. We can categorize Data Type in two flavors •Primary Data Type •Numeric •Integer •Short •Signed •Unsigned •Long •Real •Float •Double •Long Double •Non Numeric •Character •Signed •Unsigned •String (implemented as array) •Secondary Data Type •Derived Data Type •Array •Pointer •Function •User Defined Data Type •Structure •Union •Enum *At this stage our concern topic is Primary Data Type
  • 11. Integer – denoted as int – by default it is signed int Type Size (in bytes) Range Format String short int 2 -32768 to +32767 %d signed int 2 -32768 to +32767 %d unsigned int 2 0 to 65535 %u long int 4 -2147483648 to +2147483647 %ld Real Type Size (in bytes) Range Format String float 4 3.4e-38 to 3.4e+38 %f double 4 1.7e-308 to 1.7e+308 %lf long double 8 3.4e-4932 to 3.4e+4932 %le Character – denoted as char – by default it is signed char Type Size (in bytes) Range Format String signed char 1 -128 to +127 %c unsigned char 1 0 to 255 %c
  • 12.  Variable Declaration: A process to reserve space in memory for data values, where those space are identified by the name of the variable for further reference. Syntax: <data_type> <variable_name>; Example: int age; // by default takes signed int This very statement makes the compiler to reserve two byte of space in memory and identifies it with the name age. age name of location location in memory 102 base address of location MEMORY REPRESENTATION
  • 13.  Variable Initialization: A process to assign initial value to a variable at the time of declaration. By default it takes garbage value (depends on storage class specifier) Syntax: <data_type> <variable_name> = <initial_value>; Example: int age = 10; This very statement makes the compiler to reserve two byte of space in memory and identifies it with the name age and assigns 10 as its initial value. age name of location location in memory 102 base address of location MEMORY REPRESENTATION 10
  • 14. C Program Structure Statements Example 1. Documentation / Commnet Section /*Sample Program*/ 2. Header File Inclusion #include<stdio.h> 3. Macro Definition #define MAX 10 4. Global Variable Declaration int x; 5. Sub-function(s) <RT> <Function Name>(<AL>) { //body of function } 6. Main function main() { //body of main }
  • 15. Compilation Process Source code (.c) Object code (.obj) Expanded code (.i ) Assembly code (.asm) Executable code (.exe) Pre-Processing Compiling Assembling Linking & Loading Making
  • 16. First of all we make our source file with an extension .c, now the code is expanded based on Preprocessor Directives used and is stored in a file having .i extension. From this code compiler checks for syntax errors. If it is error free, compiler converts it to the assembly language of the machine being used. This is stored in file having .asm extension. Now the assembler creates .obj file. Then linking and loading software makes the link with other files if included in source code and those files are loaded in memory. Now the making process creates .exe file which is executed/run and gives our output. Meanwhile at back scene another file is created having .bak extension which keeps the back-up of source code.
  • 17. END OF CHAPTER ONE Send your feedback/queries at [email protected]