C-当把数组传递给函数
2024-10-08 13:35:01
#include <stdio.h> /**
* C语言中,数组的名称就是 一连串连续内存的起始地址,
* 因此给数组传递给函数,传递的就是数组元素类型的指针
*/ void hello_0(char msg[]);
void hello_1(char msg[]);
void hello_2(char *msg); int main() { char msg[] = "hello kitty";
char notice[] = "this is a notice to kitty.";
hello_0(msg);
hello_1(msg);
hello_2(msg); hello_0(notice);
hello_1(notice);
hello_2(notice);
return ;
} void hello_0(char msg[]) {
printf("0 msg is [%s]\n", msg);
} void hello_1(char msg[]) {
printf("1 msg is [%s]\n", msg);
} void hello_2(char *msg) {
printf("2 msg is [%s]\n", msg);
}
最新文章
- SQL查询每个表的字段数量
- Mybatis知识点总结
- 求两个数的最大公约数(Java)
- 使用XmlInclude解决WebService调用时无法识别子类的异常
- 一步步学习ASP.NET MVC3 (5)——View从Action中获得数据
- PHP remove,empty和detach区别
- [置顶] C++中RTTI机制剖析
- 微软开源PowerShell并支持Linux和OS X
- (7) 引用Objective-C class library
- 用 C++ 标准模板库(STL)的 vector 实现二叉搜索树(BST)
- Centos7 创建本地 docker 仓库极其遇到的问题
- SQL数字型注入代码审计
- HashMap 相关面试题及其解答
- 基于SDL2实现俄罗斯方块
- (7)Microsoft office Word 2013版本操作入门_常用技巧
- 浏览器跨域请求之credentials
- Web性能优化系列(2):剖析页面绘制时间
- 项目总结——MVC+MongoDB实现文件上传
- Laya资源加载小记
- Mongodb的使用(上)