Strings

3/5/99


Click here to start


Table of Contents

Strings

Outline

Strings in C

String Literals

Referring to String Literals

Duplicate String Literals

String Variables

Changing String Variables

Changing String Variables (cont)

String Input

String Input (cont)

String Input (cont)

String Output

Input/Output Example

Reading a Whole Line

Printing a String

fgets/fputs Example

fgets/fputs Example (cont)

Array of Strings

Array of Strings Example

Array of Strings Example

Array of Strings Example

String Functions

String Length

Copying a String

String Comparison

String Comparison (cont)

String Comparison (cont)

strcpy/strcmp Example

strcpy/strcmp Example

String Comparison (ignoring case)

String Concatenation

strcat Example

strcat Example

Searching for a Character/String

strchr Example

strchr Example

strstr Example

String Spans (Searching)

Parsing Strings

Parsing Strings

strtok Example

strtok Example (cont)

strtok Example (cont)

Printing to a String

sprintf Example

sprintf Example

Reading from a String

Author: Richard Maclin

Email: rmaclin@d.umn.edu

Home Page: http://www.d.umn.edu/~rmaclin/

Download presentation source