##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Null-terminated byte strings

From cppreference.com
< c‎ | string

A null-terminated byte string (NTBS) is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character). Each byte in a byte string encodes one character of some character set. For example, the character array {'\x63','\x61','\x74','\0'} is an NTBS holding the string "cat" in ASCII encoding.

### [edit] Functions

##### Character classification
Defined in header `<ctype.h>`
isalnum | checks if a character is alphanumeric (function) [edit]
isalpha | checks if a character is alphabetic (function) [edit]
islower | checks if a character is lowercase (function) [edit]
isupper | checks if a character is an uppercase character (function) [edit]
isdigit | checks if a character is a digit (function) [edit]
isxdigit | checks if a character is a hexadecimal character (function) [edit]
iscntrl | checks if a character is a control character (function) [edit]
isgraph | checks if a character is a graphical character (function) [edit]
isspace | checks if a character is a space character (function) [edit]
isblank (C99) | checks if a character is a blank character (function) [edit]
isprint | checks if a character is a printing character (function) [edit]
ispunct | checks if a character is a punctuation character (function) [edit]
##### Character manipulation
tolower | converts a character to lowercase (function) [edit]
toupper | converts a character to uppercase (function) [edit]

ASCII values (hex) | characters | `iscntrl` `iswcntrl` | `isprint` `iswprint` | `isspace` `iswspace` | `isblank` `iswblank` | `isgraph` `iswgraph` | `ispunct` `iswpunct` | `isalnum` `iswalnum` | `isalpha` `iswalpha` | `isupper` `iswupper` | `islower` `iswlower` | `isdigit` `iswdigit` | `isxdigit` `iswxdigit`
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
0 - 8 | `0x00-0x08` | control codes (`NUL`, etc.) | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`
9 | `0x09` | tab (`\t`) | `≠0` | `0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`
10 - 13 | `0x0A-0x0D` | whitespaces (`\n`,`\v`,`\f`,`\r`) | `≠0` | `0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`
14 - 31 | `0x0E-0x1F` | control codes | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`
32 | `0x20` | space | `0` | `≠0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`
33 - 47 | `0x21-0x2F` | `!"#$%&'()*+,-./` | `0` | `≠0` | `0` | `0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0`
48 - 57 | `0x30-0x39` | `0123456789` | `0` | `≠0` | `0` | `0` | `≠0` | `0` | `≠0` | `0` | `0` | `0` | `≠0` | `≠0`
58 - 64 | `0x3a-0x40` | `:;<=>?@` | `0` | `≠0` | `0` | `0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0`
65 - 70 | `0x41-0x46` | `ABCDEF` | `0` | `≠0` | `0` | `0` | `≠0` | `0` | `≠0` | `≠0` | `≠0` | `0` | `0` | `≠0`
71 - 90 | `0x47-0x5A` | `GHIJKLMNOPQRSTUVWXYZ` | `0` | `≠0` | `0` | `0` | `≠0` | `0` | `≠0` | `≠0` | `≠0` | `0` | `0` | `0`
91 - 96 | `0x5B-0x60` | `[\]^_`` | `0` | `≠0` | `0` | `0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0`
97 -102 | `0x61-0x66` | `abcdef` | `0` | `≠0` | `0` | `0` | `≠0` | `0` | `≠0` | `≠0` | `0` | `≠0` | `0` | `≠0`
103-122 | `0x67-0x7A` | `ghijklmnopqrstuvwxyz` | `0` | `≠0` | `0` | `0` | `≠0` | `0` | `≠0` | `≠0` | `0` | `≠0` | `0` | `0`
123-126 | `0x7B-0x7E` | `{|}~` | `0` | `≠0` | `0` | `0` | `≠0` | `≠0` | `0` | `0` | `0` | `0` | `0` | `0`
127 | `0x7F` | backspace character (`DEL`) | `≠0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0` | `0`

##### Conversions to numeric formats
Defined in header `<stdlib.h>`
atof | converts a byte string to a floating point value (function) [edit]
atoi atol atoll | converts a byte string to an integer value (function) [edit]
strtol strtoll | converts a byte string to an integer value (function) [edit]
strtoul strtoull | converts a byte string to an unsigned integer value (function) [edit]
strtof strtod strtold | converts a byte string to a floating point value (function) [edit]
Defined in header `<inttypes.h>`
strtoimax strtoumax (C99)(C99) | converts a byte string to intmax_t or uintmax_t (function) [edit]
##### String manipulation
Defined in header `<string.h>`
strcpy | copies one string to another (function) [edit]
strncpy | copies a certain amount of characters from one string to another (function) [edit]
strcat | concatenates two strings (function) [edit]
strncat | concatenates a certain amount of characters of two strings (function) [edit]
strxfrm | converts a substring so that it can be used by string comparison functions (function) [edit]
##### String examination
Defined in header `<string.h>`
strlen | returns the length of a given string (function) [edit]
strcmp | compares two strings (function) [edit]
strncmp | compares a certain amount of characters of two strings (function) [edit]
strcoll | compares two strings in accordance to the current locale (function) [edit]
strchr | finds the first occurrence of a character (function) [edit]
strrchr | finds the last occurrence of a character (function) [edit]
strspn | returns the length of the maximum initial segment that consists of only the characters found in another byte string (function) [edit]
strcspn | returns the length of the maximum initial segment that consists of only the characters not found in another byte string (function) [edit]
strpbrk | finds the first location of any character in one string, in another string (function) [edit]
strstr | finds the first occurrence of a substring of characters (function) [edit]
strtok | finds the next token in a byte string (function) [edit]
##### Character array manipulation
Defined in header `<string.h>`
memchr | searches an array for the first occurrence of a character (function) [edit]
memcmp | compares two buffers (function) [edit]
memset | fills a buffer with a character (function) [edit]
memcpy | copies one buffer to another (function) [edit]
memmove | moves one buffer to another (function) [edit]
##### Miscellaneous
Defined in header `<string.h>`
strerror | returns a text version of a given error code (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/string/byte&oldid=56715"