[Solved] Is there string in C?


The standard string.h header file does not define a data type called string, it provides functions for manipulating C-style strings, which are null-terminated character arrays.

For example, you can do something like:

#include <stdio.h>
#include <string.h>
int main(void) {
    char *myName = "paxdiablo";
    printf("Length of '%s' is %zu\n", myName, strlen(myName));
    return 0;
}

Note the string in that code, it’s a pointer to the paxdiablo string literal, not some string type that the standard does not provide.


C++ does provide a std::string type but that’s in the C++ string header rather than the C string.h. In any case, it doesn’t appear from their web presence that CCS provides a C++ compiler, instead focusing on the C market.

3

solved Is there string in C?