Semester - I Semester - II CSE CSE Semester - III Semester - IV CSE ...
Variable & Data type (CSE-122)
-
Upload
md-ashaf-uddaula-tanvir -
Category
Documents
-
view
79 -
download
3
Transcript of Variable & Data type (CSE-122)
Variables&
Data type
Course: CSE 122(Programming and Problem Solving)
Course Teacher: Ms. Rabeya Akhter
Section:P Depertment:CSE(43 Batch)
Group Members:
01. Md. Ashaf Uddaula (161-15-7473)
02. Alamin Hossain (161-15-7483)
03. Md. Khasrur Rahman (161-15-7214)
04. Md. Eram Talukder (161-15-7485)
05. Ijaz Ahmed Utsa (161-15-7180)
What is Variable?
Components of a Variable
Rules of Using Variable
Case Sensitivity
What is Data Type?
Classification of Data Type
Description of Some Data Types in Details
What is Variable?
A variable is a data name that may be used to store a data value.
A variable may take different values at different times during execution.
A variable can be chosen by the programmer in a meaningful way.
Components of a Variable
Rules of Using Variable
A variable must begin with a letter . Some systems may permit underscore as first character.
Uppercase & lowercase are significant . The variable "TOTAL" is different from "total" & "Total".
It should not be keyword.
Rules of Using Variable
Whitespace is not allowed.
Length should be normally more than 8 characters are treated as significant by many compilers.
Examples of valid variables are:
john,x1,T,raise,first,tag.
Examples of invalid variables area:
123,(area),25@,price$.%.
C is case sensitiveIt matters whether an identifier, such as a variable name, is uppercase or lowercase.
Example:
area
Area
AREA
ArEa
are all seen as different variables by the compiler.
What is Data Type?
Data type is a data storage formate that can contain a specific type or range of values.
When computer programs store data in variables, each variable must be assinged a specific data type.
Data types represents the type of information that can be stored in a variable.
Data types are the keywords, which are used for assigning a type to a variable.
Classification of Data Type
Description of Some Data Types in Details:
Integer Float Double
Character Void
Integers are whole numbers with a range of values supported by particular machine.
Integers occupy one word storage generally & since the word sizes of machine vary the size of interger that can be stored depends on computer.
If we use 16-bit word length,the size of integer value is limited to range -32768 to 32767
If we use 32-bit word length can store an integer ranging from -2147483648 to 2147483647.
In order to provide control over range of numbers & storage space C has 3 classes of integer storage namely: short int, int, long int in both signed & unsigned.
Short int represents fairly small integer values 7 requires half amount as regular int number uses.
Floating point numbers are stored in 32-bits , with 6 digit precision.
Floating point numbers are defined by keyword "float".
When accuracy is provided by a float number is not sufficient, double can be used to define numbers.
A double data type number uses 64-bits giving a precision of 14 digits.
These are known as double precision number.
Double data type represents the same data type that float represents but with greater precision.
To extend the precision we may use long double which uses 80 bits.
A single character can be defined as a character (char) type data.
Characters are usually store in one byte of internal storage.
Qualifier signed or unsigned may be used in char explicitly. Unsigned characters have values between 0 & 255, signed characters have values from -128 to 127.
Void type has no values.This is used to specify the type of function.
The type function is said to be void when it doesn't return any value to calling function.
EndThank You