字符数组 字符串
来源:互联网 发布:魔镜是的啥软件 编辑:程序博客网 时间:2024/06/13 09:58
字符数组赋值
例如:
main()
{
char s[100];
strcpy(s, "The writer would like to thank you for"
"your interest in his book. He hopes you"
"can get some helps from the book.");
}
指针数组赋值
例如:
main()
{
char *f[2];
int *a[2];
f[0]="thank you"; /*给字符型数组指针变量赋值*/
f[1]="Good Morning";
*a[0]=1, *a[1]=-11; /*给整型数数组指针变量赋值*/
}
1、定义的时候直接用字符串赋值
char a[10]="hello";
注意:不能先定义再给它赋值,如char a[10]; a[10]="hello";这样是错误的!
2、对数组中字符逐个赋值
char a[10]={'h','e','l','l','o'};
3、利用strcpy
char a[10]; strcpy(a, "hello");
0 0
- 字符串、字符串数组、字符数组
- 字符串、字符数组、字符指针
- 字符数组与字符串
- 字符数组与字符串(
- 字符串写入字符数组
- 字符串与字符数组
- 字符串与字符数组
- 字符数组和字符串
- 字符数组和字符串
- 指针 字符数组 字符串
- 字符串、字符数组总结
- 字符数组和字符串
- 字符数组和字符串
- 字符串与字符数组
- 字符数组/字符串
- 字符数组转换字符串:
- 字符串与字符数组
- 字符串与字符数组
- 1517:链表中倒数第k个结点 @jobdu
- nginx实现310重定向
- 删除mssql企业管理器中的服务器注册名
- 常见的百度蜘蛛IP
- Reorder List 链表首尾交叉排列@LeetCode
- 字符数组 字符串
- 【WPF】使用PSD模板制作巨漂亮的ToggleButton --- 中篇
- RaspiCam 文档翻译
- fw-2013年12月16日16:54:13 - haino tower via stack -java
- 谷歌浏览器小字体处理方案(非-webkit-text-size-adjust)
- 免费arp
- jdk环境变量配置
- Nginx server_name 如何配置二级域名
- C++中的数据类型及占字节数