Lecture5 - Beginning C for Engineers Spring 2008 Spring...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Beginning C for Engineers Spring 2008 Spring 2008 Lecture 5 Arrays • Group of memory locations related by the same name and the same type • A specific element in an array accessed by an 2/14/2008 RPI- csci1190 2 index • The lowest address the first element, the highest the last Arrays • Arrays can have from one to several dimensions 2/14/2008 RPI- csci1190 3 • The most common array is the string , which is simply an array of characters terminated by a null. Arrays • The first element in every array the zeroth element 2/14/2008 RPI- csci1190 4 • An array of 5 elements: c[ 0 ] c[ 1 ] c[ 2 ] c[ 3 ] c[ 4 ] Single-Dimension Arrays • General format for declaring a single dimension array: type var_name [ size ] ; e.g. 2/14/2008 RPI- csci1190 5 int c[100]; • An element is accessed by indexing the array name, e.g. c[ 2 ] = 5; Array Initialization • Using a loop, e.g. for ( i = 0; i <100; i++) c[i] = 0; 2/14/2008 RPI- csci1190 6 • In a definition with an initializer list, e.g....
View Full Document

This note was uploaded on 04/08/2008 for the course CSCI 1190 taught by Professor Minooaminian during the Spring '08 term at Rensselaer Polytechnic Institute.

Page1 / 19

Lecture5 - Beginning C for Engineers Spring 2008 Spring...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online