12 array memory using our two previously dened arrays

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: 8 integer values. Arrays can be of any data type (i.e. float, double, char, etc.) • At this point, the array size (memory alloca4on) must be fixed in the declara4on. We cannot make the array bigger or smaller. 11 Array Ini4aliza4on • Arrays ini4aliza4on is done using the { and } braces. – For example: double s[5] = {50.0, 72.3, 90.9, 66.6, 41.7 }; or double s = {50.0, 72.3, 90.9, 66.6, 41.7 }; Both set the array size to 5 elements. This is the only 4me an array can be ini4alized this way. 12 Array Memory • Using our two previously defined arrays y and s we show the contents in memory: y[0] s y[2] y[3] y[4] y[5] y[6] y[7] ? ? ? ? ? ? ? ? s[0] y y[1] s[1] s[2] s[3] s[4] 50.0 72.3 90.9 66.6 41.7 • No4ce array y - un4l the values in the array are defi...
View Full Document

This document was uploaded on 03/10/2014 for the course ENGINEER 2sh4 at McMaster University.

Ask a homework question - tutors are online