SlideShare a Scribd company logo
In this session, you will learn to:
Identify the benefits and features of C language
Use the data types available in C language
Identify the structure of C functions
Use input-output functions
Use constructs
Objectives
Identifying the Benefits and Features of C Language
Ken Thompson developed a new language called B.
B language was interpreter-based, hence it was slow.
Dennis Ritchie modified B language and made it a
compiler-based language.
The modified compiler-based B language is named as C.
C language:
Possesses powerful low-level features of second generation
languages.
Provides loops and constructs available in third generation
languages.
Is very powerful and flexible.
C as a Second and Third Generation Language
C language:
Offers all essentials of structured programming.
Has functions that work along with other user-developed
functions and can be used as building blocks for advanced
functions.
Offers only a handful of functions, which form the core of the
language.
Has rest of the functions available in libraries. These functions
are developed using the core functions.
Block Structured Language - An Advantage for Modular
Programming
Features of the C Language
The features that make C a widely-used language are:
Pointers: Allows reference to a memory location by a name.
Memory Allocation: Allows static as well as dynamic memory
allocation.
Recursion: Is a process in which a functions calls itself.
Bit Manipulation: Allows manipulation of data in its lowest form
of storage.
Using the Data Types Available in C language
The types of data structures provided by C can be classified
under the following categories:
Fundamental data types
Derived data types
Fundamental Data Types
Fundamental Data Types:
Are the data types at the lowest level.
Are used for actual data representation in the memory.
Are the base for other data types.
Have machine dependent storage requirement.
Are of the following three types:
char
int
float
The storage requirement for fundamental data types can be
represented with the help of the following table.
Data Number of bytes on a
32-byte machine
Minimum Maximum
char 1 -128 127
int 4 -2^31 (2^31) - 1
float 4 6 digits of precision 6 digits of precision
Fundamental Data Types (Contd.)
Derived Data Types
Derived Data Types:
Are represented in memory as fundamental data type.
Some derived data types are:
short int
long int
double float
The storage requirement for derived data types can be
represented with the help of the following table.
Data Number of bytes
on a 32-byte
machine
Minimum Maximum
short int 2 -2^15 (2^15) - 1
long int 4 -2^31 (2^31) - 1
double float 8 12 digits of precision 6 digits of
precision
Derived Data Types (Contd.)
Defining Data
The syntax for defining data is:
[data type] [variable name],...;
Declaration is done in the beginning of a function.
Definition for various data types is shown in the following
table.
Data definition Data type Memory defined Size (bytes) Value assigned
char a, c; char a
c
1
1
-
-
char a = 'Z'; char a 1 Z
int count; int count 4 -
int a, count =10; int a
count
4
4
-
10
float fnum; float fnum 4 -
float fnum1,
fnum2 = 93.63;
float fnum1
fnum2
4
4
-
93.63
Practice: 1.1
Write the appropriate definitions for defining the following
variables:
1. num to store integers.
2. chr to store a character and assign the character Z to it.
3. num to store a number and assign the value 8.93 to it.
4. i, j to store integers and assign the value 0 to j.
Practice: 1.1 (Contd.)
Solution:
1. int num;
2. char chr=’Z’;
3. float num = 8.93;
4. int i, j=0;
Defining Strings:
Syntax:
char (variable) [(number of bytes)];
Here number of bytes is one more than the number of
characters to store.
To define a memory location of 10 bytes or to store 9 valid
characters, the string will be defined as follows:
char string [10];
Defining Data (Contd.)
Practice: 1.2
Write the appropriate definitions for defining the following
strings:
1. addrs to store 30 characters.
2. head to store 14 characters.
Practice: 1.2 (Contd.)
Solution:
1. char addrs[31];
2. char head[15];
Summary
In this session, you learned that:
C language was developed by Ken Thompson and Dennis
Ritchie.
C language combines the features of second and third
generation languages.
C language is a block structured language.
C language has various features that make it a widely-used
language. Some of the important features are:
Pointers
Memory Allocation
Recursion
Bit-manipulation
Summary (Contd.)
The types of data structures provided by C can be classified
under the following categories:
Fundamental data types: Include the data types, which are used
for actual data representation in the memory.
Derived data types: Are based on fundamental data types.
Fundamental data types:
char, int, and float
Some of the derived data types are:
short int, long int, and double float
Definition of memory for any data, both fundamental and
derived data types, is done in the following format:
[data type] [variable name],...;
Summary (Contd.)
In C language, the functions can be categorized in the
following categories:
Single-level functions
Multiple-level functions
For standard input-output operations, the C environment uses
stdin, stdout, and stderr as references for accessing the
devices.
There are two types of constructs in C language:
Conditional constructs
Loop constructs
Each Unit contains 40 to 60
slides in it. 

More Related Content

PDF
Notes of programming
PPTX
PPTX
C++
 
PPS
C programming session 11
PPTX
Programming fundamentals 3
PPTX
Introduction to c programming language
PPTX
Programming in c
PDF
C programming Ms. Pranoti Doke
Notes of programming
C++
 
C programming session 11
Programming fundamentals 3
Introduction to c programming language
Programming in c
C programming Ms. Pranoti Doke

What's hot (18)

PPTX
C101 – Intro to Programming with C
PDF
Basic Information About C language PDF
DOCX
C tutorials
DOC
C language
PPT
Tokens_C
PPTX
Data Types and Variables In C Programming
PPT
Introduction To C
PPTX
Aniket tore
DOCX
Bca1020 programming in c
DOCX
Features of c language 1
DOCX
Cs6660 compiler design may june 2016 Answer Key
PDF
Python Tutorial Questions part-1
PDF
C++ programming intro
PPSX
Lecture 2
PDF
Introduction to ‘C’ Language
DOC
Computer systems architecture assignment/tutorialoutlet
PDF
International journal of compiling
PPTX
What is Data Types and Functions?
C101 – Intro to Programming with C
Basic Information About C language PDF
C tutorials
C language
Tokens_C
Data Types and Variables In C Programming
Introduction To C
Aniket tore
Bca1020 programming in c
Features of c language 1
Cs6660 compiler design may june 2016 Answer Key
Python Tutorial Questions part-1
C++ programming intro
Lecture 2
Introduction to ‘C’ Language
Computer systems architecture assignment/tutorialoutlet
International journal of compiling
What is Data Types and Functions?
Ad

Viewers also liked (19)

PPTX
Mari domingiren etorrera
PPS
PPT
A tour around san vicente de la barquera maria
PPS
WCF (Windows Communication Foundation_Unit_01)
PPS
Data Structures and Algorithms Unit 01
PPS
PPT
RDBMS_Unit 01
PPS
PPS
J2ME Unit_01
PPS
Web Component Development with Servlet and JSP Technologies Unit 01
PPS
Advanced excel unit 01
PPS
WPF (Windows Presentation Foundation Unit 01)
PPT
Types of operators in C
PPTX
Introduction to c programming
PPT
VB.Net GUI Unit_01
PPTX
Introduction of c programming
PPT
C ppt
PPTX
PPTX
Operator in c programming
Mari domingiren etorrera
A tour around san vicente de la barquera maria
WCF (Windows Communication Foundation_Unit_01)
Data Structures and Algorithms Unit 01
RDBMS_Unit 01
J2ME Unit_01
Web Component Development with Servlet and JSP Technologies Unit 01
Advanced excel unit 01
WPF (Windows Presentation Foundation Unit 01)
Types of operators in C
Introduction to c programming
VB.Net GUI Unit_01
Introduction of c programming
C ppt
Operator in c programming
Ad

Similar to C programming unit 01 (20)

PPS
C programming session 01
PPSX
C language (Collected By Dushmanta)
PPTX
C Programming ppt for beginners . Introduction
PPS
C programming session 01
PPTX
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
DOCX
PDF
C programming_MSBTE_Diploma_Pranoti Doke
PPTX
PPS
C programming session 01
PPTX
Fundamental of C Programming (Data Types)
PPTX
Data-Types-in-C-Programming.Programming.pptxProgramming.pptxpptx
PPTX
TAPASH kumar das its my college pptasjhk
PPTX
Data Type in C Programming
PDF
Embedded C - Lecture 2
PPTX
C data types, arrays and structs
PPTX
C language
PDF
C Programming - Refresher - Part I
PDF
Data structure & Algorithms - Programming in C
PPTX
Data types
C programming session 01
C language (Collected By Dushmanta)
C Programming ppt for beginners . Introduction
C programming session 01
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
C programming_MSBTE_Diploma_Pranoti Doke
C programming session 01
Fundamental of C Programming (Data Types)
Data-Types-in-C-Programming.Programming.pptxProgramming.pptxpptx
TAPASH kumar das its my college pptasjhk
Data Type in C Programming
Embedded C - Lecture 2
C data types, arrays and structs
C language
C Programming - Refresher - Part I
Data structure & Algorithms - Programming in C
Data types

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced IT Governance
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
Teaching material agriculture food technology
PDF
Modernizing your data center with Dell and AMD
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Cloud computing and distributed systems.
NewMind AI Weekly Chronicles - August'25 Week I
Advanced IT Governance
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Teaching material agriculture food technology
Modernizing your data center with Dell and AMD
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)

C programming unit 01

  • 1. In this session, you will learn to: Identify the benefits and features of C language Use the data types available in C language Identify the structure of C functions Use input-output functions Use constructs Objectives
  • 2. Identifying the Benefits and Features of C Language Ken Thompson developed a new language called B. B language was interpreter-based, hence it was slow. Dennis Ritchie modified B language and made it a compiler-based language. The modified compiler-based B language is named as C.
  • 3. C language: Possesses powerful low-level features of second generation languages. Provides loops and constructs available in third generation languages. Is very powerful and flexible. C as a Second and Third Generation Language
  • 4. C language: Offers all essentials of structured programming. Has functions that work along with other user-developed functions and can be used as building blocks for advanced functions. Offers only a handful of functions, which form the core of the language. Has rest of the functions available in libraries. These functions are developed using the core functions. Block Structured Language - An Advantage for Modular Programming
  • 5. Features of the C Language The features that make C a widely-used language are: Pointers: Allows reference to a memory location by a name. Memory Allocation: Allows static as well as dynamic memory allocation. Recursion: Is a process in which a functions calls itself. Bit Manipulation: Allows manipulation of data in its lowest form of storage.
  • 6. Using the Data Types Available in C language The types of data structures provided by C can be classified under the following categories: Fundamental data types Derived data types
  • 7. Fundamental Data Types Fundamental Data Types: Are the data types at the lowest level. Are used for actual data representation in the memory. Are the base for other data types. Have machine dependent storage requirement. Are of the following three types: char int float
  • 8. The storage requirement for fundamental data types can be represented with the help of the following table. Data Number of bytes on a 32-byte machine Minimum Maximum char 1 -128 127 int 4 -2^31 (2^31) - 1 float 4 6 digits of precision 6 digits of precision Fundamental Data Types (Contd.)
  • 9. Derived Data Types Derived Data Types: Are represented in memory as fundamental data type. Some derived data types are: short int long int double float
  • 10. The storage requirement for derived data types can be represented with the help of the following table. Data Number of bytes on a 32-byte machine Minimum Maximum short int 2 -2^15 (2^15) - 1 long int 4 -2^31 (2^31) - 1 double float 8 12 digits of precision 6 digits of precision Derived Data Types (Contd.)
  • 11. Defining Data The syntax for defining data is: [data type] [variable name],...; Declaration is done in the beginning of a function. Definition for various data types is shown in the following table. Data definition Data type Memory defined Size (bytes) Value assigned char a, c; char a c 1 1 - - char a = 'Z'; char a 1 Z int count; int count 4 - int a, count =10; int a count 4 4 - 10 float fnum; float fnum 4 - float fnum1, fnum2 = 93.63; float fnum1 fnum2 4 4 - 93.63
  • 12. Practice: 1.1 Write the appropriate definitions for defining the following variables: 1. num to store integers. 2. chr to store a character and assign the character Z to it. 3. num to store a number and assign the value 8.93 to it. 4. i, j to store integers and assign the value 0 to j.
  • 13. Practice: 1.1 (Contd.) Solution: 1. int num; 2. char chr=’Z’; 3. float num = 8.93; 4. int i, j=0;
  • 14. Defining Strings: Syntax: char (variable) [(number of bytes)]; Here number of bytes is one more than the number of characters to store. To define a memory location of 10 bytes or to store 9 valid characters, the string will be defined as follows: char string [10]; Defining Data (Contd.)
  • 15. Practice: 1.2 Write the appropriate definitions for defining the following strings: 1. addrs to store 30 characters. 2. head to store 14 characters.
  • 16. Practice: 1.2 (Contd.) Solution: 1. char addrs[31]; 2. char head[15];
  • 17. Summary In this session, you learned that: C language was developed by Ken Thompson and Dennis Ritchie. C language combines the features of second and third generation languages. C language is a block structured language. C language has various features that make it a widely-used language. Some of the important features are: Pointers Memory Allocation Recursion Bit-manipulation
  • 18. Summary (Contd.) The types of data structures provided by C can be classified under the following categories: Fundamental data types: Include the data types, which are used for actual data representation in the memory. Derived data types: Are based on fundamental data types. Fundamental data types: char, int, and float Some of the derived data types are: short int, long int, and double float Definition of memory for any data, both fundamental and derived data types, is done in the following format: [data type] [variable name],...;
  • 19. Summary (Contd.) In C language, the functions can be categorized in the following categories: Single-level functions Multiple-level functions For standard input-output operations, the C environment uses stdin, stdout, and stderr as references for accessing the devices. There are two types of constructs in C language: Conditional constructs Loop constructs
  • 20. Each Unit contains 40 to 60 slides in it. 

Editor's Notes

  • #2: Begin the session by explaining the objectives of the session.
  • #3: Discuss the history of the C language.
  • #8: The storage requirements for different data types are machine-dependent. There is a subtle difference between declaring and defining variables. The statement: char a; Is used to declare a variable a. Here, only the attributes of the variable are specified, not the contents. In contrast, the statement: char a = ‘A’; is used to define the contents of the variable a.
  • #10: Derived data types modify the data according to the specific requirements. For example, if you need to store a integer value above 32,767 or below -32,767, you can use long int instead of int. the derived data type long increases the range of the int data type.
  • #13: Use Slide 12 to test the student’s understanding on defining the variables.
  • #16: Use Slide 15 to test the student’s understanding on defining the variables.
  • #18: Use Slides 51, 52, and 53 to summarize the session.