0% found this document useful (0 votes)
0 views

Unit-1-Part-B

The document outlines the character representation in the C programming language, detailing the types of characters supported, including alphabets, digits, and special characters. It explains the purpose of character sets in defining valid characters for source programs and execution, as well as the significance of ASCII values in representing these characters. Additionally, it provides references for further reading on C programming.

Uploaded by

pranav verma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Unit-1-Part-B

The document outlines the character representation in the C programming language, detailing the types of characters supported, including alphabets, digits, and special characters. It explains the purpose of character sets in defining valid characters for source programs and execution, as well as the significance of ASCII values in representing these characters. Additionally, it provides references for further reading on C programming.

Uploaded by

pranav verma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Course Name: Bachelor of Technology(B.

Tech-CSE)
Course Code: 19002200
Subject: Introduction to Programming with C (Unit-I-Part-b)

Faculty Name:
Dr. Saba Hilal

Professor (CSE)
School of
Engineering &
Technology

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Topic
Concepts of Character Representation

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


[9] Use of Character Set in C
• Just like we use a set of various words, numbers, statements, etc.,
in any language for communication, the C programming language
also consists of a set of various different types of characters.
These are known as the characters in C. They include digits,
alphabets, special symbols, etc. The C language provides support
for about 256 characters.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Use of Character Set in C
• Every program that we draft for the C program consists of
various statements. We use words for constructing these
statements. Meanwhile, we use characters for constructing these
statements. These characters must be from the C language
character set. Let us look at the set of characters offered by the C
language.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Types of Characters in C
• The C programming language provides support for the following
types of characters. In other words, these are the valid characters
that we can use in the C language:

• Alphabets
• Digits
• Special Characters
• All of these serve a different set of purposes, and we use them in
different contexts in the C language.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Alphabets
• The C programming language provides support for all the
alphabets that we use in the English language. Thus, in simpler
words, a C program would easily support a total of 52 different
characters- 26 uppercase and 26 lowercase.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Digits
• The C programming language provides the support for all the
digits that help in constructing/ supporting the numeric values
or expressions in a program. These range from 0 to 9, and also
help in defining an identifier. Thus, the C language supports a
total of 10 digits for constructing the numeric values or
expressions in any program.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Special Characters
• We use some special characters in the C language for some
special purposes, such as logical operations, mathematical
operations, checking of conditions, backspaces, white spaces, etc.
• We can also use these characters for defining the identifiers in a
much better way. For instance, we use underscores for
constructing a longer name for a variable, etc.
• The C programming language provides support for the following
types of special characters:

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


White Spaces
The white spaces in the C programming language contain the
following:
• Blank Spaces
• Carriage Return
• Tab
• New Line

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Purpose of Character Set in C
The character sets help in defining the valid characters that we can
use in the source program or can interpret during the running of the
program. For the source text, we have the source character set,
while we have the execution character set that we use during the
execution of any program.

But we have various types of character sets. For instance, one of the
character sets follows the basis of the ASCII character definitions,
while the other set consists of various kanji characters (Japanese).

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Purpose of Character Set in C
The type of character set we use will have no impact on the
compiler- but we must know that every character has different,
unique values. The C language treats every character with different
integer values. Let us know a bit more about the ASCII characters.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


ASCII Values
• All the character sets used in the C language have their
equivalent ASCII value. The ASCII value stands for American
Standard Code for Information Interchange value. It consists
of less than 256 characters, and we can represent these in 8 bits
or even less. But we use a special type for accommodating and
representing the larger sets of characters.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


ASCII Values
• However, a majority of the ANSI-compatible compilers in C
accept these ASCII characters for both the character sets- the
source and the execution. Every ASCII character will correspond
to a specific numeric value.

• Here is a list of all the ASCII characters, along with their assigned
numeric values.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C


Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C
Reference Books and Links
1. Ashok N. Kamthane, “Computer Basics and C Programming”, Pearson Education.
2. E. BalaGuruswamy, “Programming in ANSI C”, 2008.
3. V Rajaraman, “Computer Basics and C Programming”, PHI.
4. Herbert Schildt, “C The Complete Reference” Fourth Edition, 2000.
5. YashwantKanetkar, “Let us C” eighth edition, 2002.
6. Kernighan and d. Ritchie, “The ANSI C Programming Language”, 2000.
7. StephennPrata, “C Primer Plus” Fourth Edition, 2001.
8. Schaum’s Outline Series, “Programming with C”, 2nd Edition, 1996.
9. https://byjus.com/gate/character-set-in-c/#:~:text=All%20the%20character%20sets%20used,8%20bits%20or%20even%20less.

Programme Name Semester- B.Tech-I-Sem Subject- Introduction To Programming with C

You might also like