Variables and Computer Memory

Slides:



Advertisements
Similar presentations
Etter/Ingber Arrays and Matrices. Etter/Ingber One-Dimensional Arrays 4 An array is an indexed data structure 4 All variables stored in an array are of.
Advertisements

Program Memory MIPS memory operations Getting Variable Addresses Advanced structures.
Chapter 9 Pointers and Dynamic Arrays. Overview 9.1 Pointers 9.2 Dynamic Arrays.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Hand Crafting your own program By Eric Davis for CS103.
Variables and Constants
General Computer Science for Engineers CISC 106 Lecture 28 Dr. John Cavazos Computer and Information Sciences 04/29/2009.
Arrays Liang, Chpt 5. arrays Fintan Array of chars For example, a String variable contains an array of characters: An array is a data structure.
Arrays Horstmann, Chapter 8. arrays Fintan Array of chars For example, a String variable contains an array of characters: An array is a data structure.
Basic C Programming Data Types and Arithmetic Operations 01/30/15.
PHYS 2020 Making Choices; Arrays. Arrays  An array is very much like a matrix.  In the C language, an array is a collection of variables, all of the.
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
CIS Computer Programming Logic
VARIABLES AND TYPES CITS1001. Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Scope.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
 Structures are like arrays except that they allow many variables of different types grouped together under the same name. For example you can create.
PROCESSING Types. Objectives Be able to convert between binary and decimal numbers. Be able to declare and initialize character variables and constants.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
C Programming Lecture 16 Pointers. Pointers b A pointer is simply a variable that, like other variables, provides a name for a location (address) in memory.
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
Program Organization Sequential Execution: One line done after the other Conditional Execution: If a test is true, one section is done, otherwise another.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
1.2 Primitive Data Types and Variables
More than just a song and dance.. They are objects that store primitive variable values: Integer – stores an int Double – stores a double Character –
CSC 142 F 1 CSC 142 References and Primitives. CSC 142 F 2 Review: references and primitives  Reference: the name of an object. The type of the object.
1 st Semester Module2 Basic C# Concept อภิรักษ์ จันทร์สร้าง Aphirak Jansang Computer Engineering.
Topics for today: 1.Comments 2.Data types 3.Variable declaration.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
A basic tutorial for fundamental concepts
Variable Declarations
Building Java Programs
Introduction to Python Data Types and Variables
Data Types The type states how much and what kind of data the variable can store. integers- whole numbers no fractional parts int, short, long floating.
Lecture 10: More on Methods and Scope
Introduction to C++ October 2, 2017.
Arrays in C.
void Pointers Lesson xx
Variables ,Data Types and Constants
Thinking about programming
Chapter 2.
Structures Lesson xx In this module, we’ll introduce you to structures.
Variables with Memory Diagram
Building Java Programs Chapter 2
Computers & Programming Languages
Building Java Programs
Pointer to Structures Lesson xx
C++ Data Types Data Type
Variables Title slide variables.
Building Java Programs
Arrays ICS2O.
Data Types Imran Rashid CTO at ManiWeber Technologies.
Building Java Programs Chapter 2
INC 161 , CPE 100 Computer Programming
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
Building Java Programs
C Programming Lecture-8 Pointers and Memory Management
C Programming Pointers
Variables Here we go.
Introduction to Programming
Building Java Programs Chapter 2
Data Types and Maths Programming Guides.
C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
Variables and Constants
SPL – PS2 C++ Memory Handling.
Introduction to Pointers
Presentation transcript:

Variables and Computer Memory In most all computers, your program and your data (variables) are stored in the computer’s memory (you can read about it here) like in the picture on the right. Each location in memory has an address (a number) numbered from 0 to however big your memory is (e.g., say you have 2GB of memory, then the addresses are from 0 to 2GB). Now, it’d be a real pain to have to keep track of all the memory address you might use in a program, but the good news is that you don’t have to do this, because you can name memory locations and then just use the names. This is what a variable declaration does, it names a piece of memory and tells the computer what you want to keep there (e.g., a character, a string, an integer, etc.). Once a variable is declared, you can refer to it or change it as often as you want to make the computer program do what you want. int a; int b = 5; double x = 4.23; bool myVar = true; char c = ‘?’; string n = “Joe”; Memory n: Joe At address 0x0 c: ? myVar: true b: 5 x: 4.23 addr 0xBE680C 0x80000000 a: 4350684771