Lecture_14_Functions__Preprocessors(2_of_3)(阅读).pptVIP

  • 2
  • 0
  • 约2.07万字
  • 约 66页
  • 2016-12-11 发布于重庆
  • 举报

Lecture_14_Functions__Preprocessors(2_of_3)(阅读).ppt

Intelligent Information Processing Lab., Dept.of Computer Sci. Tech.,YBU 示例-10:字符串复制函数mystrcpy 注记*:与函数mystrcpy中的s2对应的字符串可以是字符串常量,原因是C把字符串常量存储在编译器定义的无名数组中,s2的各元素可表示该数组的各符号(此时不得修改s2元素的值!) Arrays as Arguments * void test(char s[ ]) { s[0]=’C’ ; s[2]=’A’ ; … } 此时,调用test (”ABC”);可能会导致严重问题! s[0] s[1] s[2] s[3] 常量 C A Intelligent Information Processing Lab., Dept.of Computer Sci. Tech.,YBU 数据共享示例【重点】 考虑二维数组情况——综合性实验指导书函数部分实验内容(3) Arrays as Arguments * main() { int x[2][3]; f(x, 2); … } void f(int a[ ][3], int n) { int b[3]; … } x[0][0] a[0][0] x[0][1] x[0][2] x[1][0] x[1][1] x[1][2]

文档评论(0)

1亿VIP精品文档

相关文档