strlen返回的是size_t数据转化为short可能溢出
void test()
{
short len=strlen("12345"); // size_t to short
}
文章标签 strlen返回的是size_t数据转化 文章分类 C/C++ 后端开发
strlen返回的是size_t数据转化为short可能溢出
void test()
{
short len=strlen("12345"); // size_t to short
}
上一篇: 最小值求反溢出
下一篇: 指针常量 和 常量指针
看头文件可知,size_t是unsigned int,用来表示字节的个数,因此没有负数
在C语言中,很多库参数的参数和返回值的数据类型是size_t,让很多初学都不理解
转自 : http://blog.csdn.net/zhaowei123191/article/details/561
Linux 数据类型: size_t 与 ssize_t 的理解
size_t和intsize_t是一些C/C...
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M