| 我的分类 |
|
|
|
|
|
|
|
华为笔试的一道题
|
华为笔试的一道题
在windows下,写出运行结果,说明为什么? 1、 int arr[]={6,7,8,9,10};
int *ptr=arr;
*(ptr++)+=123;
printf("line11%d,%d",*ptr,*(++ptr));
printf("line22%d,%d",*ptr,*(ptr++));
2、 int arr[]={6,7,8,9,10};
int *ptr=arr;
*(ptr++)=*(ptr++)+123;
printf("%d,%d",*ptr,*(++ptr));
|
|
|
原文地址
http://www.net0791.com/article/45552.htm
|
|
发表于: 2007-03-07,修改于: 2007-03-07 16:37 已浏览1181次,有评论3条
推荐
投诉
|
|
|
|
网友评论 |
|
本站网友 | 时间:2007-06-10 18:13:08 IP地址:58.213.73.★ |
|
|
1. line11 129, 7 line22 7, 7
2. 130, 8
|
|
|
|
ohy3686
| 时间:2007-06-10 19:50:44 IP地址:202.107.226.★ |
|
|
第一题是: line11 8, 8 line22 8, 8
在VC6环境下实验的,运行后arr[]={129,7,8,9,10}。
第二题是:9,9。
不知道各位高手有没有什么看法?
|
|
|
|
ohy3686
| 时间:2007-06-10 19:56:14 IP地址:202.107.226.★ |
|
|
对于第二题是:
int *ptr=arr; arr=ptr=0x0012ff68
*(ptr++)=*(ptr++)+123; ptr=0x0012ff70 *ptr=8
printf("%d,%d",*ptr,*(++ptr)); ptr=0x0012ff74 *ptr=9
arr[]={129,7,8,9,10}
|
|
|
|
| |