Lecture 3

initialization arraytype x 1 3 4 if you don

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: ion and Assignment • Array assignment is illegal!!!!!! • Initialization: arrayType X = {1, 3, 4}; • If you don’ initialize all values, the rest are t set to 0. • Arrays in function headers may have open sizes . • Arrays are never passed by value. 7 CONST Array Parameters int compute_somethg(const int vals, int N); N stores the valid size which the function might want to know. CONST avoids sideeffects in the array. We need this as arrays are not passed by value. 8 Two-Dimensional Arrays Arrays of Arrays • int matrix [num_of_rows][num_of_cols]; • matrix [0][0], ... matrix[0][1], matrix[0][2], matrix [1][0],.... • Initialization is possible as before. Values are assigned in the above order, that is “row-wise.” • typedef int column[10];// def column • typedef column columns[20]; //columns • columns my_numbers; • my_...
View Full Document

This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.

Ask a homework question - tutors are online