Pointers and Char Strings


Pointers and Char Strings

  • char name[20], *cptr = name; is valid
  • while (*cptr != ‘\0’) or (*cptr) is true until the end of the string is reached
  • while (*cptr); length = cptr – name;
  • char *name; name = “Delhi” is accepted
  • Char arrays with variable row length are called ragged arrays, better handled by ptrs

No comments:

Post a Comment