14 what is scope local and global an object with

Info icon This preview shows pages 3–4. Sign up to view the full content.

View Full Document Right Arrow Icon
initialized and increased on each iteration. 14. What is scope: local and global? An object with global scope is declared as a global variable. Objects with local scope are constructed at the site of their declaration and are destructed when control reaches the end of the program unit (function, method, block) that contains the declaration. 15. What are one dimensional and two dimensional arrays? One dimensional array stores numbers in one direction (horizontal only) eg imagine an array called 'array' with the following values: 1, 2, 3, 4, 5 array[0] would be 1, array[4] would be 5 (arrays are zero-indexed) A two-dimensional array stores data in a data structure which is both horizontal and vertical eg imagine an array called '2Darray' with the following values: 1, 2, 3, 4 5, 6, 7, 8 9, 10, 11, 12 2Darray[0][1] would be the first column of the second row (again zero-indexed), so 5 2Darray[3][2] would be the fourth column of the third row, so 12 2Darray[2][3] would be out-of-range of the array and would cause either a compile time or run-time error. This is something you need to be careful of when using arrays.
Image of page 3

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

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