llapioNoteSet06

llapioNoteSet06 - 1 Principles of Programming I Note Set#6...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Principles of Programming I Note Set #6 2 Homework 2 Review • Static Variables in Main? • Recursion? 3 Let’s Review First • 3 Steps in using file I /O • 3 different data types with file I /O • Library to include when using file I /O • 3 different access flags when opening a file • Passing file objects to functions 4 Semester Overview Functions Character File I /O Arrays Pointers and Dynamic Memory Allocation Structures/Records Binary File I /O 5 Variables so far. . . • The variables we’ve used so far only hold one piece of data at any particular time. int a = 10; float area = 10.25243; 6 Array • An array – Holds multiple pieces of data – I s accessible using an identifier (array name) with a index – Has a fixed size (that must be known at compile time) – Each individual element called element – Arrays are 0 (zero) subscripted • Start counting slots/elements from zero 7 One Zip Code – Many Box Numbers 8 Array Declaration int empHours[10]; Data type of the elements Array Name Size Declarator (How many items to hold) int n[3] = {12, 24, 48}; ? ? ? n[0] n[1] n[2] 24 12 48 Array Declaration and Initializtation 9 Array in Memory empHours[9] empHours[8] empHours[7] empHours[6] empHours[5] empHours[4] empHours[3] empHours[2] empHours[1] empHours[0] ? ? ? ? ? ? ? ? ? ? • Array is a contiguous block of memory slots • Size of the array (amount of memory used) is NumSlots*sizeof(datatype) 10 Example Array Declarations float temp[100]; const int SIZE = 25; int class[SIZE]; double sizes[2500]; 11 Array Declaration and Initialization int n[3] = {12}; ? ? ?...
View Full Document

This note was uploaded on 05/06/2008 for the course CSE 1341 taught by Professor Lapio during the Spring '07 term at SMU.

Page1 / 33

llapioNoteSet06 - 1 Principles of Programming I Note Set#6...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online