By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Slides:



Advertisements
Similar presentations
Lecture Computer Science I - Martin Hardwick The Programming Process rUse an editor to create a program file (source file). l contains the text of.
Advertisements

Variables in C Amir Haider Lecturer.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 7: User-Defined Functions II.
Chapter 7: User-Defined Functions II
1 Homework Turn in HW2 at start of next class. Starting Chapter 2 K&R. Read ahead. HW3 is on line. –Due: class 9, but a lot to do! –You may want to get.
Structure of a C program
CS1061 C Programming Lecture 4: Indentifiers and Integers A.O’Riordan, 2004.
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
Storage Classes.
COMPUTER PROGRAMMING. Data Types “Hello world” program Does it do a useful work? Writing several lines of code. Compiling the program. Executing the program.
C++ for Engineers and Scientists Third Edition
C Tokens Identifiers Keywords Constants Operators Special symbols.
The string data type String. String (in general) A string is a sequence of characters enclosed between the double quotes "..." Example: Each character.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 3A Integral Data (Concepts)
PASSING VALUE TO A FUNCTION # CALL BY VALUECALL BY VALUE # CALL BY REFERENCECALL BY REFERENCE STORAGE CLASS # AUTOAUTO # EXTERNALEXTERNAL # STATICSTATIC.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
COP 3275 COMPUTER PROGRAMMING USING C Instructor: Diego Rivera-Gutierrez
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
1.4 Representation of data in computer systems Instructions.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MTech[IT],MPhil (Comp.Sci), MCA, MSc[IT], PGDCA, ADCA, Dc. Sc. & Engg.
Types of C Variables:  The following are some types of C variables on the basis of constants values it has. For example: ○ An integer variable can hold.
Number Representation Lecture Topics How are numeric data items actually stored in computer memory? How much space (memory locations) is.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Data Types Always data types will decide which type of information we are storing into variables In C programming language we are having 3 types of basic.
Chapter 2. Variable and Data type
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Lecture 4 Monday Sept 9, Variables and Data Types ►A►A►A►A variable is simply a name given by the programmer that is used to refer to computer storage.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Course Contents KIIT UNIVERSITY Sr # Major and Detailed Coverage Area
User Interaction and Variables
COM S 326X Deep C Programming for the 21st Century Prof. Rozier
EPSII 59:006 Spring 2004.
trigraph ??= is for # ??( is for [ ??< is for { ??! is for |
Data Representation – Instructions
CSE101-Lec#3 Components of C Identifiers and Keywords Data types.
Advanced Programming Basics
פרטים נוספים בסילבוס של הקורס
Stack Memory 2 (also called Call Stack)
Basics of ‘C’.
C++ Data Types Data Type
Local Variables, Global Variables and Variable Scope
C Storage classes.
AKA the birth, life, and death of variables.
Chapter 2: Introduction to C++.
Programming Language C Language.
In C Programming Language
Building Blocks of C Programming Language
Variables in C Topics Naming Variables Declaring Variables
C Language B. DHIVYA 17PCA140 II MCA.
Structures in c By Anand George.
Pointer Arithmetic By Anand George.
Functions By Anand George.
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
File handling in C By Anand George.
C Programming Lecture-17 Storage Classes
Variables and Constants
Storage classes in C In C language, each variable has a storage class which decides the following things: scope i.e where the value of the variable would.
Data in a C++ Program Numeric data and character data
Storage Classes.
Presentation transcript:

By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

As we saw General nature of Computer programs.  Read or Write to computer memory.  Do operations on the data in the computer memory  Hand over the data to other parts of the program for more operations. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Variables  In C program computer memory is accessed via “variables”.  Or variables in C program is a representation of computer memory.  Again Variables are nothing but memory so it remember things which we called values in the variable.  All variable store binary 1s and 0s as computer cannot remember anything else. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Variable types  Based on size and type char, int, float, unsigned int and more ( custom).  Based on storage global, static, local or auto and register. One more storage class called thread local storage we wont discussion. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Demo  char, int, float, unsigned int.  global, static, local or auto and register.  scope of variable. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Remember  All variables are binary digits at the end of the day.  What makes each type different is just the way we interpret it. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Questions  Why int is not used for representing English alphabets ? to save memory  Why we cannot use float always why we need int? to save CPU time. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Demo  Interpreting int as char using %c  Looking at memory in visual studio char float and int.  Looking at memory to see the actual value stored. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Summary  Variables types and classification.  All 1s and 0s.  All we interpret differently.  There is more but this is all we need for now. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Thank you SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)