数组的大小及定义sizeof和strlen
来源:互联网 发布:龙泉驾校网络授课 编辑:程序博客网 时间:2024/05/21 04:16
char a[] = "abcd";char b[] = {'a','b','c','e','f'};int d = strlen(a);//4int e = strlen(b);//16cout << d << " " << e << endl;cout << a[2]<<" "<<b[2]<< endl;return 0;char st[20] = "hello\0\t\\"; int d = strlen(st);int f = sizeof(st);cout << d <<" "<<f<< endl;//d=5,只计算hello的长度,在结尾再次添加也没有用("hello\0\t\\qqq"),只是5,只有在前面添加有用,原因是\0,但是\0后面要是数字会变,为什么?.因为遇到\0就结束!//f=20,开辟的空间大小多少,就是多少,return 0;char st[20] = "hello\t\\";//7个char st[20] = "\77";//这个是\7后面的转为7进制?,不清楚,实验暂时得出\7后面如果不是数字\7算是1个字符,如果是,则\7加上后面挨着的数字算一个,大数会报错int d = strlen(st);//为1int f = sizeof(st);//20cout << d <<" "<<f<< endl;char st[20] = "89A\77";int d = strlen(st);//4int f = sizeof(st);char st[20] = "89A\t7";int d = strlen(st);//5int f = sizeof(st);strlen("asdasde\t\'\\wang\'!\t");//17每个\+后边的一个算一个,\\算一个,\a,算一个
0 0
- 数组的大小及定义sizeof和strlen
- 数组的sizeof和strlen
- 有关数组的运算:sizeof()和strlen()
- C/C++中字符串数组及strlen()和sizeof()区别
- 数组中的strlen和sizeof
- C语言中 数组的运算及sizeof()和strlen()操作符的简单介绍
- 数组的计算 sizeof strlen
- sizeof和strlen的区别,数组和指针的区别
- 字符串,字符指针和字符数组的sizeof和strlen
- 字符串大小总结sizeof和strlen
- 关于数组的 sizeof和strlen 的一些计算
- 字符数组和指针的sizeof(),strlen()以及getline()
- 发现关于数组求其长度 strlen 和 sizeof的问题
- 比较分析与数组相关的sizeof和strlen
- 了解sizeof和strlen以及关于数组的相关计算
- sizeof和strlen与数组之间的恩恩怨怨
- sizeof 和 strlen及字节对齐的问题
- strlen和sizeof的使用及用法补充
- SharePoint 2013 设置网站集为”只读”
- iOS7 background fetch 实战详解:让app自动/智能获取数据以优化用户体验
- 排序算法
- ELK(Windows下配置)
- 设计模式--[2]原型模式
- 数组的大小及定义sizeof和strlen
- Android ViewPager实现无限循环(1.首尾完美过渡)
- KVM qcow2、raw、vmdk等镜像格式和转换
- 深度遍历和广度遍历
- 欢迎使用CSDN-markdown编辑器
- hbase 伪分布式环境的搭建
- List tuple 类型转成数组
- xcode编译的时候卡住
- haha