#include <string.h>
#include <stdio.h>
void main( )
{
unsigned char test[30] = "How do you do!";
int len;
len = strlen(test);
printf( "'%s' is %d characters long\n", test, len );
}
E:\C++文件\temp.cpp(8) : error C2664: 'strlen' : cannot convert parameter 1 from 'unsigned char [30]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
上面编译时总是报错。
只要把unsigned char test[30] = "How do you do!";这行的unsigned去掉就不报错了,不知是为什么(搞不明白)?
strlen出现一些怪问题?