[go: up one dir, main page]

0% found this document useful (0 votes)
8 views8 pages

Lec 02 Part 1 DataTypes

The document provides an overview of programming concepts related to data types, variables, and input/output in C programming. It explains the definition and characteristics of variables, including naming conventions and the distinction between identifiers and keywords. Additionally, it outlines the basic data types supported by C, such as char, int, float, and double, along with their properties.

Uploaded by

Rajesh . K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Lec 02 Part 1 DataTypes

The document provides an overview of programming concepts related to data types, variables, and input/output in C programming. It explains the definition and characteristics of variables, including naming conventions and the distinction between identifiers and keywords. Additionally, it outlines the basic data types supported by C, such as char, int, float, and double, along with their properties.

Uploaded by

Rajesh . K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CS10003:

Programming & Data Structures

Dept. of Computer Science & Engineering


Indian Institute of Technology Kharagpur

Autumn 2020
Data-types,
Variables and I/O
Character Sets in C
Alphabets: A, B, …, Z
a, b, …, z
Digits: 0, 1, …9
Special Characters:
, < > .; % \ | ~ # ? ( ) “ “ + etc.
White Space Characters:
blank space, newline, tab etc
Variables
A variable is an entity that has a value and is
known to the program by a name.
A variable definition associates a memory
location with the variable name.
A variable can have only one value assigned
to it at any given time during the execution
of the program.
Its value gets updated/changed during the
execution of the program.
Example: f= 1.8 * c + 32
Variable Names
Sequence of letters and digits.
First character is a letter.
Examples: i, rank1, MAX, Min, class_rank
dataType
Invalid examples:
a’s, fact rec, 2sqroot
class,rank
Identifiers and Keywords
Identifiers are used to identify or name variables.
Identifiers names must be sequences of letters and
digits, and must begin with a letter
The underscore character ‘_’ is considered a letter
Names should not be the same as a keyword like ‘int’,
‘char’, ‘void’ etc.
C is case sensitive.
For any internal identifier, at least the first 31
characters are significant in any ANSI C Compiler.
Data Types
C language supports the following basic data types:
char: a single byte that can hold one
character
int: an integer
float: a single precision floating point number
double: a double precision floating point
number

Precision refers to the number of significant digits after


the decimal point.
Data Types
Abstraction is necessary.

Integer Data Types:


Integers are whole numbers that can
assume both positive and negative values,
i.e., elements of the set:
{ ..., -3, -2, -1, -, 1, 2, 3, ... }

You might also like