strlen的()非空值终止字符串的字符? [英] strlen() on non-null-terminated char string?

查看:437
本文介绍了strlen的()非空值终止字符串的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的strlen(为const char * S)定义时,取值是不是空终止,如果是这样,这是什么回来?

Is strlen(const char *s) defined when s is not null-terminated, and if so, what does it return?

推荐答案

没有,它没有定义。它可能会导致存储器访问冲突,因为它会继续计数直到它达到第一存储器字节,其值是0

No, it is not defined. It may result in a memory access violation, as it will keep counting until it reaches the first memory byte whose value is 0.

这篇关于strlen的()非空值终止字符串的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆