C Programming

⌘K
  1. Home
  2. Docs
  3. C Programming
  4. Arrays and Strings
  5. Character Array and String in C

Character Array and String in C

A character array is a sequence of characters stored in contiguous memory locations.

A string in C is a character array terminated by a null character ‘\0’.

Example:

char name[6] = {'H', 'e', 'l', 'l', 'o', '\0'};

or simply:

char name[] = "Hello";  // Automatically adds '\0'

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *