标准string.h
头文件确实not定义了一种称为string
的数据类型,它提供了用于处理C样式字符串的函数,这些字符串是空终止的字符数组。
例如,您可以执行以下操作:
#include <stdio.h>
#include <string.h>
int main(void) {
char *myName = "paxdiablo";
printf("Length of '%s' is %zu\n", myName, strlen(myName));
return 0;
}
请注意该代码中的字符串,它是指向paxdiablo
字符串文字的指针,not标准未提供的某些string
类型。
C ++ does提供std::string
类型,但是在C ++ string
标头中,而不是C string.h
中。无论如何,从他们的web presence看来,CCS并没有提供C ++编译器,而是专注于C市场。