strlen and sizeof
来源:互联网 发布:数据记录表 编辑:程序博客网 时间:2024/05/01 00:06
Given:
#include<stdio.h> int main() { char s1[] = { 'M', 'y', 'W', 'o', 'r', 'd' }; char s2[] = "MyWord"; printf("%d %d\n",strlen(s1),strlen(s2));//random num 6 printf("%d %d\n",sizeof(s1),sizeof(s2));//7 7 return 0; }
ANSWER:
strlen: not including \0;
random a number cuz s1 is not a string, searching until \0;
try char s1[] = { 'M', 'y', 'W', 'o', 'r', 'd','\0'},strlen returns 6;
sizeof: including \0;
- sizeof and strlen
- sizeof and strlen
- strlen and sizeof
- sizeof and strlen
- 8.sizeof() and strlen()
- sizeof and strlen
- strlen and sizeof
- sizeof and strlen
- sizeof and strlen
- sizeof and strlen整理
- sizeof and strlen
- sizeof and strlen
- different of strlen() and sizeof()
- The difference between sizeof and strlen
- c语言知识1-sizeof and strlen
- The difference between sizeof and strlen
- Sizeof() and Strlen()的区别-20151026
- strlen, sizeof
- 云计算:中兴通讯的“新引擎”
- 云计算是一种商业模式 未来将无处不在
- ARM要在2、3年内获得笔记本市场10%至20%
- 有意思
- 我常用的几个第三方 Python 库
- strlen and sizeof
- 一种三极管开关电路设计
- 读取M到N条记录
- C++错误:重定义 不同的存储类 二次定义的解决方法
- ubuntu 包管理之“:E: 读错误 - read (5: 输入/输出错误) E: 无法解析或打开软件包的列表或是状态文件。”的解决
- 64位服务器IIS程序发布
- Android 权限大全
- 开源社区的管理模式
- android发送json并解析返回json