CSUN COMP 106 - Data Types (5 pages)

Previewing pages 1, 2 of 5 page document View the full content.
View Full Document

Data Types



Previewing pages 1, 2 of actual document.

View the full content.
View Full Document
View Full Document

Data Types

89 views


Pages:
5
School:
California State University, Northridge
Course:
Comp 106 -

Unformatted text preview:

February 7 2006 Data Types Outline Data Types Declarations and Initializations Review last week Meaning of data types Integer data types have no decimal point and integer division truncates Floating point data types approximate representation of decimal numbers Character string and boolean logical data types Larry Caretto Computer Science 106 Computing in Engineering and Science February 7 2005 2 Review of Last Week Review of Last Week II Basic elements of C programs Screen output using cout and Keyboard input using cin and Variables refer to memory locations Template include using namespace std int main return EXIT SUCCESS C is case sensitive White space does not matter except in string constants End statements with a semicolon Braces and frame logical code blocks Will use in lab this week Use letters numbers and Start with letter or 31 characters maximum Use meaningful names Variables are case sensitive x2 is not X2 3 4 Review Variables and Memory Program variables refer to computer memory RAM locations When we use a variable say x we get the value in the memory location the compiler associated with this variable Computer Memory 100 12 2 104 3 5 Var 101 15 Address x1 102 PI 103 3 1415926 0 rad 105 nam 106 CSUN Value i Variable name y2 107 data 13 Cells show memory address associated variable name and value stored if any What is effect of y2 PI rad rad x 3 assigns the value 3 to x cout x writes value of x to the screen y x assigns value of x to y x x 3 replaces x by x 3 5 What happens to cell 106 to cells 102 and 104 Cell 106 gets the new value of 3 5 2 Cells 102 and 104 are not changed 6 1 February 7 2006 Data Types Computer Memory 100 12 2 104 3 5 Var 101 15 x1 102 PI 103 3 1415926 0 rad 105 nam 106 CSUN Computer Memory i 12 2 y2 107 data 13 What is effect of data x1 100 104 3 5 PI 103 3 1415926 0 i rad 105 nam 106 CSUN y2 107 data 13 103 What happens to cell 100 The value of 12 2 is replaced by 12 2 3 5 15 7 Are any other cells affected No 7 8 Computer Memory



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Data Types and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Data Types and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?