 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.

Slides:



Advertisements
Similar presentations
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Advertisements

Programming Languages and Paradigms The C Programming Language.
Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Constants and Data Types Constants Data Types Reading for this class: L&L,
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
Structure of a C program
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
PZ04A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ04A - Scalar and composite data Programming Language.
Data Types.
Overview Working directly with memory locations is beneficial. In C, pointers allow you to: change values passed as arguments to functions work directly.
Programming Principles Data types and Variables. Data types Variables are nothing but reserved memory locations to store values. This means that when.
CS 330 Programming Languages 10 / 21 / 2008 Instructor: Michael Eckmann.
CIS Computer Programming Logic
Names Variables Type Checking Strong Typing Type Compatibility 1.
C Tokens Identifiers Keywords Constants Operators Special symbols.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Five Tips to Success. Work hard Try more exercises and more practice.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Lecture #5 Introduction to C++
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
1 Records Record aggregate of data elements –Possibly heterogeneous –Elements/slots are identified by names –Elements in same fixed order in all records.
 Character set is a set of valid characters that a language can recognise.  A character represents any letter, digit or any other sign  Java uses the.
These notes were originally developed for CpSc 210 (C version) by Dr. Mike Westall in the Department of Computer Science at Clemson.
What is C? C is a programming language. It was developed in 1972 USA. It was designed and written by a man named dennis ritchie. C is the base for all.
Types(1). Lecture 52 Type(1)  A type is a collection of values and operations on those values. Integer type  values..., -2, -1, 0, 1, 2,...  operations.
Copyright Curt Hill Variables What are they? Why do we need them?
Java Programming, Second Edition Chapter Two Using Data Within a Program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
C++ for Java Programmers Chapter 2. Fundamental Daty Types Timothy Budd.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
1.2 Primitive Data Types and Variables
CPS120: Introduction to Computer Science Variables and Constants.
MIT AITI Lecture 2 The of Java In the following lectures you will learn the basic structures that make up the Java programming language: »Variables.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage:
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.2 Primitive Data Types Almost all programming languages.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Data Types Chapter 6: Data Types Lectures # 12. Topics Chapter 6: Data Types 2 Introduction Primitive Data Types Character String Types Array Types Associative.
1 Scalar and composite data Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Scalar and composite data Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Sections Basic Data Structures. 1.5 Data Structures The way you view and structure the data that your programs manipulate greatly influences your.
Integer VariablestMyn1 Integer Variables It must be possible to store data items in a program, and this facility is provided by variables. A variable is.
Fundamentals 2.
The Machine Model Memory
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Chapter 6 – Data Types CSCE 343.
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Chapter 6: Data Types Lectures # 10.
ITEC113 Algorithms and Programming Techniques
CS 326 Programming Languages, Concepts and Implementation
EPSII 59:006 Spring 2004.
Chapter 2.
Complex Data Types One very important measure of the “goodness” of a PL is the capability of its data types to model the problem space variables Design.
Data.
Introduction to Abstract Data Types
Computers & Programming Languages
Chapter 2: Java Fundamentals
Chapter # 2 Part 2 Programs And data
Chapter 2: Java Fundamentals
C Programming Lecture-8 Pointers and Memory Management
C Language B. DHIVYA 17PCA140 II MCA.
Assistant Professor Rabia Koser Dept. of Computer Applications
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable › Possible operations which can be executed on the type › Meaning of the data › Different ways to store the data  Data Types are of different types: Primitive data Types Composite Data Types

› Primitive data types are those data types which are not defined in terms of other data types. Examples are: Integer Floating Point Boolean Character

 Integers are used to hold integer values only.  This is further categorized into: byte short int long signed Unsigned Examples are: unsigned int x = 21234; unsigned int y = 31234; unsigned int z; z = x + y;

 This data type contains decimal points.  Examples are: float f = 20.0 / 3.0;

 Boolean Data type is used to store logical value.  It can have either True or False value.  It is a one bit representation › 0 represents false value › 1 represents true value › Example: Boolean a; › a=true;

 Roman alphabet, punctuation, digits, and other symbols: › Can encode within one byte (256 symbols)  In C: char a_char = ’a’; char newline_char = ’\n’; char tab_char = ’\t’; charbackslash_char = ’\\’;

 These data types are derived from more than one primitive data type.  Examples are: Arrays Records Structure Union

 Arrays are a finite sequence of variables of the same data type These are commonly implemented by the compiler generating array descriptors for each array here we have descriptors for 1-D and multi-D arrays

 Records are Varied aggregate of data elements › The elements of a record are known as fields or members › Records were introduced in COBOL › This data type is used in many languages. › In Java, the functionality of records are achieved through the use of classes Examples: COBOL (nested structure in one definition) 01 EMPLOYEE-RECORD. 02 EMPLOYEE-NAME. 05 FIRST PICTURE IS X(10). 05 MIDDLE PICTURE IS X(10). 05 LAST PICTURE IS X(20). 02 HOURLY-RATE PICTURE IS 99V99.

 Types which can store different types of variables at different times of execution at the same memory location. › Example:  Integer X Real Y Equivalence (X, Y)  declares one memory location for both X and Y  the Equivalence statement is not a type, it just commands the compiler to share the same memory location  Other languages have union types › the type defines same or common location for two variables of different types

 Used for indirect addressing for dynamic memory › dynamic memory when allocated, does not have a name, so these are unnamed or anonymous variables and can only be accessed through a pointer  Pointers store memory locations or null › usually null is a special value so that pointers can be implemented as special types of int values  By making pointers a specific type, some static allocation is possible › the pointer itself can be allocated at compile- time, and uses of the pointer can be type checked at compile-time int *, float *, char * – used to denote a pointer type, which is a memory address type