Strings.doc - Strings In C language Strings are defined as an array of characters or a pointer to a portion of memory containing ASCII characters A

Strings.doc - Strings In C language Strings are defined as...

This preview shows page 1 - 2 out of 3 pages.

Strings In C language Strings are defined as an array of characters or a pointer to a portion of memory containing ASCII characters. A string in C is a sequence of zero or more characters followed by a NULL '\0' character: It is important to preserve the NULL terminating character as it is how C defines and manages variable length strings. All the C standard library functions require this for successful operation. All the string handling functions are prototyped in: string.h or stdio.h standard header file. So while using any string related function, don't forget to include either stdio.h or string.h. May be your compiler differs so please check before going ahead. If you were to have an array of characters WITHOUT the null character as the last element, you'd have an ordinary character array, rather than a string constant. String constants have double quote marks around them, and can be assigned to char pointers as shown below. Alternatively, you
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 3 pages?

  • Fall '16
  • ASCII, char array

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture