This preview shows page 1. Sign up to view the full content.
Unformatted text preview: an expression can be changed
x This is very useful to avoid confusion / when unsure about
This which promotion will occur
x Syntax: (<type>)
float x = (float)
(2 / 3)
x Arrays are a collection of data elements organized in a
Arrays specific order
specific Roughly: a set of variables of the same type that can be accessed
in an homogeneous way
x Arrays are the core data structure to program useful things Matrices, images Data structures (stack, queue, graph, tree, etc.)
programmed using arrays
programmed 98 One-dimensional arrays in C++
x Syntax to declare an array: <type> <name>[<size>]
x Syntax to pass a 1-d array allocated as above as argument
Syntax to a function:
void foo(int array, char array2)
99 Some observations on arrays
x Arrays are always pass-by-reference
x Be careful: an array has the same liveness as a variable E.g., if declared within a function, the array...
View Full Document
This note was uploaded on 04/03/2014 for the course CS 31 taught by Professor Melkanoff during the Fall '00 term at UCLA.
- Fall '00