Download
array n.
Skip this Video
Loading SlideShow in 5 Seconds..
Array PowerPoint Presentation

Array

154 Views Download Presentation
Download Presentation

Array

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Array Cs212: DataStructures Lab 2

  2. Array • Group of contiguous memory locations • Each memory location has same name • Each memory location has same type a is the name of this array Array index or subscript

  3. Declaring , Allocating an initialize Arrays • Declare array of zero (JAVA ) 1- Default Each int is initialized to 0 by default

  4. 2- Or we can use initializer List

  5. Declare array of zero (c++) 1- using Loop 2- Or we can use initializer List OUT PUT

  6. Initialize the array with different value using initializer list (C++) (JAVA) Output

  7. Initialize the array with user inputs (JAVA)

  8. Initialize the array with user inputs (C++) Output

  9. Ex 1: • Calculate value stored in each array element • Initialize elements of 10-element array to even integers start the even number from 2.

  10. Answer: (java)

  11. Answer: (C++) Output

  12. EX2: • Array elements • Can represent a series of values • We can sum these values

  13. Answer: (C++) Output

  14. Answer: (java)