際際滷

際際滷Share 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

What's hot (20)

C fundamentals
C fundamentalsC fundamentals
C fundamentals
shaheed benazeer bhutto university (shaheed benazeerabad)
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
Aditya Vaishampayan
Unit ii ppt
Unit ii pptUnit ii ppt
Unit ii ppt
ANJALAI AMMAL MAHALINGAM ENGINEERING COLLEGE
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
niyamathShariff
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Sabik T S
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
Muthuganesh S
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
Dr. SURBHI SAROHA
7 functions
7  functions7  functions
7 functions
MomenMostafa
1 introducing c language
1  introducing c language1  introducing c language
1 introducing c language
MomenMostafa
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
Abir Hossain
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
Dr. SURBHI SAROHA
C introduction by thooyavan
C introduction by  thooyavanC introduction by  thooyavan
C introduction by thooyavan
Thooyavan Venkatachalam
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
Rumman Ansari
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)
Dr. SURBHI SAROHA
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
MomenMostafa
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
Saranya saran
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
Saranya saran
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
niyamathShariff
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Sabik T S
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
Muthuganesh S
1 introducing c language
1  introducing c language1  introducing c language
1 introducing c language
MomenMostafa
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
Abir Hossain
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
Dr. SURBHI SAROHA
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
Rumman Ansari
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
MomenMostafa
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
Saranya saran
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
Saranya saran
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
JavvajiVenkat

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

C material
C materialC material
C material
tarique472
Intro in understanding to C programming .pptx
Intro in understanding to C   programming .pptxIntro in understanding to C   programming .pptx
Intro in understanding to C programming .pptx
abadinasargie
Intro in understanding to C programming .pptx
Intro in understanding to C   programming .pptxIntro in understanding to C   programming .pptx
Intro in understanding to C programming .pptx
abadinasargie
Chap 2 c++
Chap 2 c++Chap 2 c++
Chap 2 c++
Widad Jamaluddin
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
sanatahiratoz0to9
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
UNIT - 1-  Ood ddnwkjfnewcsdkjnjkfnskfn.pptxUNIT - 1-  Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
crazysamarth927
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
Qazi Shahzad Ali
C
CC
C
Jerin John
Presentation c++
Presentation c++Presentation c++
Presentation c++
JosephAlex21
Fundamentals of computers - C Programming
Fundamentals of computers - C ProgrammingFundamentals of computers - C Programming
Fundamentals of computers - C Programming
MSridhar18
Lecture 2
Lecture 2Lecture 2
Lecture 2
Mahfuzur Rahman
C programming introduction for beginners.pdf
C programming introduction for beginners.pdfC programming introduction for beginners.pdf
C programming introduction for beginners.pdf
sagarduari1
C tutorials
C tutorialsC tutorials
C tutorials
Amit Kapoor
C programming language
C programming languageC programming language
C programming language
Abin Rimal
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Rohit Singh
C notes
C notesC notes
C notes
Raunak Sodhi
introductory concepts
introductory conceptsintroductory concepts
introductory concepts
Walepak Ubi
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
Vigneshkumar Ponnusamy
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
Intro in understanding to C programming .pptx
Intro in understanding to C   programming .pptxIntro in understanding to C   programming .pptx
Intro in understanding to C programming .pptx
abadinasargie
Intro in understanding to C programming .pptx
Intro in understanding to C   programming .pptxIntro in understanding to C   programming .pptx
Intro in understanding to C programming .pptx
abadinasargie
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
sanatahiratoz0to9
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
UNIT - 1-  Ood ddnwkjfnewcsdkjnjkfnskfn.pptxUNIT - 1-  Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
crazysamarth927
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
Qazi Shahzad Ali
Presentation c++
Presentation c++Presentation c++
Presentation c++
JosephAlex21
Fundamentals of computers - C Programming
Fundamentals of computers - C ProgrammingFundamentals of computers - C Programming
Fundamentals of computers - C Programming
MSridhar18
C programming introduction for beginners.pdf
C programming introduction for beginners.pdfC programming introduction for beginners.pdf
C programming introduction for beginners.pdf
sagarduari1
C programming language
C programming languageC programming language
C programming language
Abin Rimal
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Rohit Singh
introductory concepts
introductory conceptsintroductory concepts
introductory concepts
Walepak Ubi
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
Vigneshkumar Ponnusamy

Recently uploaded (20)

Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
 Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ... Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
coreylewis960
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham
Knownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdfKnownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdf
Pragya - UEM Kolkata Quiz Club
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study MaterialPass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Jenny408767
MIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel HolznerMIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel Holzner
MIPLM
3. AI Trust Layer, Governance Explainability, Security & Compliance.pdf
3. AI Trust Layer, Governance  Explainability, Security & Compliance.pdf3. AI Trust Layer, Governance  Explainability, Security & Compliance.pdf
3. AI Trust Layer, Governance Explainability, Security & Compliance.pdf
Mukesh Kala
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
How to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting AppHow to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting App
Celine George
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptxCLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷sHow to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
Celine George
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptxANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
PRADEEP ABOTHU
How to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 WebsiteHow to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 Website
Celine George
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptxBIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
maniramkumar
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VIAnti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Samruddhi Khonde
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptxO SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
AituzazKoree
10.socialorganisationandsocialsystem .pptx
10.socialorganisationandsocialsystem .pptx10.socialorganisationandsocialsystem .pptx
10.socialorganisationandsocialsystem .pptx
Vivek Bhattji
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
home
A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptxA-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
Quiz Club of PSG College of Arts & Science
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
 Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ... Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...
coreylewis960
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study MaterialPass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Pass SAP C_C4H47_2503 in 2025 | Latest Exam Questions & Study Material
Jenny408767
MIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel HolznerMIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel Holzner
MIPLM
3. AI Trust Layer, Governance Explainability, Security & Compliance.pdf
3. AI Trust Layer, Governance  Explainability, Security & Compliance.pdf3. AI Trust Layer, Governance  Explainability, Security & Compliance.pdf
3. AI Trust Layer, Governance Explainability, Security & Compliance.pdf
Mukesh Kala
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
How to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting AppHow to Setup Company Data in Odoo 17 Accounting App
How to Setup Company Data in Odoo 17 Accounting App
Celine George
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptxCLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷sHow to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
How to Install Odoo 18 with Pycharm - Odoo 18 際際滷s
Celine George
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptxANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT PPT.pptx
PRADEEP ABOTHU
How to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 WebsiteHow to Manage Check Out Process in Odoo 17 Website
How to Manage Check Out Process in Odoo 17 Website
Celine George
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptxBIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
BIOPHARMACEUTICS AND PHARMACOKINETICS(BP604T) - Copy (3).pptx
maniramkumar
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VIAnti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Anti-Fungal Agents.pptx Medicinal Chemistry III B. Pharm Sem VI
Samruddhi Khonde
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptxO SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
AituzazKoree
10.socialorganisationandsocialsystem .pptx
10.socialorganisationandsocialsystem .pptx10.socialorganisationandsocialsystem .pptx
10.socialorganisationandsocialsystem .pptx
Vivek Bhattji
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
20250402 ACCA TeamScienceAIEra 20250402 v10.pptx
home
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde

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 abhisheksinha786@gmail.com