This preview shows page 1. Sign up to view the full content.
Unformatted text preview: numbers ... first column
• my_numbers ... second number in the
first column. (Note that the order is
inversed relative to a two-D array.) 9 Strings
• A string is an array of characters.
• Literal strings are written as “abcd”
• The compiler adds a ‘ to the end of a
literal string. Thus the array has to be by
one larger than the largest text string.
• Strings are are assigned with
strcpy(target,source) from “string.h”
11 10 More on Strings
• strcmp(S1, S2) returns 0 if two strings are
the same. It returns a negative number if S1
is before S2, and a positive number
• strcat(S1, S2) appends S2 to the end of S1
and returns S1. In other words, it is sideeffecting.
12 String I/O
• Strings can be read with cin >> if no white
space is contained in them.
• Strings can be written with cout <<
View Full Document
- Spring '09
- Assembly Language