UMBC CMSC 201 & 201H Fall '98 CSEE | 201 | 201 F'98 | lectures | news | help

Strings

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

  • The NULL character, '\0' is ascii 0.

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

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

    str

    FE09

    'c'

    'a'

    't'

    '\0'

    .

  • 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'98 | lectures | news | help