UMBC CMSC 201 Fall '05
CSEE | 201 | 201 F'05 | lectures | news | help


  • Strings are sequences of characters that are terminated with a the special character, the NULL character, '\0'.

  • Strings are represented as arrays of characters, where the last character of the string is the NULL character, '\0'.

  • This combination declaration and initialization: char str[5] = "cat"; has the following representation.








    Have you heard this one??

    These two strings walk into a bar and sit down.
    The bartender says, "So what'll it be?"

    The first string says, "I think I'll have a beer quag fulk boorg2jdk^C"

    The second string says, "Please excuse my friend. He isn't null-terminated."

  • Many functions have already been written for manipulating strings and they are found in the ANSI C string library.

  • To use functions in this library you'll need to #include <string.h>

    CSEE | 201 | 201 F'05 | lectures | news | help

    Last Modified - Monday, 26-Sep-2005 11:20:42 EDT