Online Programming Server

Login

Login with facebook [?]

Facebook

Tutorial 77: Chapter 5 - String & Character Functions

You are here: Tutorials >> Basic >> C >> C Programming Basics >> Chapter 5 - String & Character Functions

Tutorial ID77
TitleChapter 5 - String & Character Functions

What is a C-string? (again and again...)

  • As repeated for so many times in the previous chapters
    • A C-style string is a NULL-terminated character array
  • A string constant is enclosed by a pair of double-quotes (")
    • "This is a string constant!"
  • A string constant is of the type
    • char* or char[] and implicitly cast to const char* or const char[]
  • A string ends with a null character
    • const char* s = {'a','b','c','\0'};
  • is identical to
    • const char* s = "abc";

Post Your Comment

Title
Message