Lecture 12 - Strings

Lecture 12 - Strings - Strings Oct 24, 2006 Last Time while...

Info iconThis preview shows pages 1–3. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Strings Oct 24, 2006 Last Time while ( test ) { actions; } for ( initialization; test; increment ) { actions; } Last Time (cont.) i++; /* means: i=i+1; */ i--; /* means: i=i-1; */ i+=2; /* means: i=i+2; */ i-=2; /* means: i=i-2; */ Last Time (cont.) int x[10]; declares an array of 10 integer elements elements are numbered from 0 to 9 x[3] = 7; /* stores 7 in position 3 (the 4th spot) */ printf(%d,x[3]); /* prints the value in position 3 (the 4th spot) */ IMPORTANT Assignment 3 does NOT require the use of strings. In fact, I discourage the use of strings for this assignment because: 1. You dont need them. 2. You are not allowed to use string functionality anyway. Strings Strings are a common data-type in C. Represented as an array of characters. E.g. char string[128]; Array Gotchas Remember that in C there is nothing to prevent you from going beyond the end (or beginning) of an array....
View Full Document

Page1 / 4

Lecture 12 - Strings - Strings Oct 24, 2006 Last Time while...

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

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