DAY28
Monday, 16 July 2012
Today we might talk about:
-
How characters work; how to capitalize a character; how to
represent a single quote; special characters like newline and null
and backslash;
-
How a "string" is simply an array of characters;
-
Working with known-length strings: capitalize a string, concatenate two strings;
-
Variable length string: using the null character as a terminator;
-
Working with variable length strings: initialize, concatenate, and test for equality
-
Reading a string from the terminal using scanf;
Programs and functions we might talk about:
-
equalstrings.c,
a function which is true if two (variable length) strings are equal.
-
p10.1.c,
a program which concatenates two known-length strings.
-
p10.2.c,
a program which determines the length of a variable-length string.
-
p10.3.c,
a program which concatenates two variable-length strings.
-
p10.4.c,
a program which compares two variable-length strings for equality.
-
p10.5.c,
a program which asks the user to enter text, and reads three words of that text.
-
printable.c,
Shows the first 128 characters - if they are printable, and a "*" if not.
-
special.c,
a program which shows how to set and print special characters,
such as a single or double quote, a backslash, or a new line.
-
stringlength.c,
a function which returns the length of a (variable length) string.
-
upper_lower.c,
a program which shows how to go between lowercase and uppercase characters.
Last revised on 13 July 2012.