llapioNoteSet06

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

Info icon This preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Principles of Programming I Note Set #6
Image of page 1

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

View Full Document Right Arrow Icon
2 Homework 2 Review Static Variables in Main? Recursion?
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
4 Semester Overview Functions Character File I/O Arrays Pointers and Dynamic Memory Allocation Structures/Records Binary File I/O
Image of page 4
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;
Image of page 5

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

View Full Document Right Arrow Icon
6 Array An array Holds multiple pieces of data Is 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
Image of page 6
7 One Zip Code – Many Box  Numbers
Image of page 7

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

View Full Document Right Arrow Icon
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
Image of page 8
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)
Image of page 9

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

View Full Document Right Arrow Icon
10 Example Array Declarations float temp[100]; const int SIZE = 25; int class[SIZE]; double sizes[2500];
Image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern