资源预览内容
第1页 / 共2页
第2页 / 共2页
亲,该文档总共2页全部预览完了,如果喜欢就下载吧!
资源描述
Chapter 11Answers to Selected Exercises2.was #2 (e), (f), and (i) are legal. (a) is illegal becausepis a pointer to an integer andiis an integer. (b) is illegal because*pis an integer and&iis a pointer to an integer. (c) is illegal because&pis a pointer to a pointer to an integer andqis a pointer to an integer. (d) is illegal for reasons similar to (c). (g) is illegal becausepis a pointer to an integer and*qis an integer. (h) is illegal because*pis an integer andqis a pointer to an integer.4.was #4; modifiedvoid swap(int *p, int *q) int temp; temp = *p; *p = *q; *q = temp;6.was #6void find_two_largest(int a, int n, int *largest, int *second_largest) int i; if (a0 a1) *largest = a0; *second_largest = a1; else *largest = a1; *second_largest = a0; for (i = 2; i *largest) *second_largest = *largest; *largest = ai; else if (ai *second_largest) *second_largest = ai;
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号