资源描述:
《黄建的C语言课后习题_12_高级指针.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、全国计算机等级考试二级C语言考前辅导指针的高级应用Page 23(1)[2004.4.36]以下程序的运行结果是(9)若有:int k[2][3], *pk[3];,则各选项中正确的是char *p[ ]={"abc","abcdef","abcde","abcd","ab"}; A)pk = k;B)pk = k[0];printf("%d", strlen(p[4])); C)pk[1] = &k; D)pk[0] = &k[1][2];(2)[2012.3.13]填空实现程序功能:输出a数组中所(10)以下程序的运
2、行结果是有字符串int a = 10, b[ ] = {2,4,6,8}; char *a[ ] = {"ABC","DE","FGH","IJ"}; int *w[3] = {&a, b, &b[2]}; int i = 0; printf("%d%d%d%d", w[0][0], w[1][0], w[1][1],for ( ; i < 4; i++)w[2][0]); printf("%s", ); (11)[2004.9.34]程序中,*(p[0]+1)的值是(3)[2009.3.31]以下程序的运行结果是int
3、 a[3][2] = {1,3,5,7,9,11}, *p[3];char *a[ ] = {"abcd","ef","gh","ijk"}; p[0] = a[1];int i; (12)[2010.3.10]以下程序的运行结果是for (i = 0; i < 4; i++)int a[ ] = {1,2,3,4,5,6}, *k[3], i = 0; printf("%c", *a[i]); while (i < 3)(4)[2012.3.11]以下程序的运行结果是{char *a[4] = {"red","green"
4、,"blue"}; k[i] = &a[2*i];int i = 0; printf("%d", *k[i]); while (a[i]) i++; {putchar(a[i][0]); i++; }}(5)[2007.9.32]以下程序的运行结果是(13)[2008.4.9]以下程序的运行结果是void fun(char **p)int x[ ] = {1,2,3,4,5,6,7,8,9,10,11}; {int *p[4], i; ++p; printf("%s", *p); for (i = 0; i < 4; i
5、++)}{main()p[i] = &x[2*i+1];{printf("%d", p[i][0]); char *a[ ] = {"Sun", "Mon", ”Tue", "Wed"}; }fun(a); (14)[2010.3.27]若有: int (*p)[3];则正确选项是}A)定义了基类型为int的三个指针变量(6)[2006.4.42]以下程序运行后n的值是B)p是基类型为int的具有三个元素的指针数组char *w[ ] = {"3697", "2584"}; C)定义了名为*p,具有三个元素的整型数组int
6、i, j, n = 0; D)定义了一个名为p的指针变量,它可以指向每for (i = 0; i < 2; i++)行有三个整数元素的二维数组for (j = 0; j < 4; j += 2)(15)[2004.9.29]选项中能正确引用c数组元素的是n = n * 10 + w[i][j] '0'; int c[4][5], (*p)[5];(7)[2006.9.38][2012.3.28]以下存在语法错误的是p = c;A)char ss[6][20];ss[1] = "right?"; A)p+1B)*(p+3)B
7、)char ss[ ][20] = {"right?"}; C)*(p+1)+3D)*(p[0]+2)C)char *ss[6];ss[1] = "right?"; (16)[2005.4.32]输入:123<回车>,则输出结果是D)char *ss[ ] = {"right?"}; int a[3][2] = {0}, (*p)[2], i, j; (8)[2005.9.15]若有:char *line[5];,以下正确的是p = a; A)line是一个数组,每个元素是一个基类型为for(i = 0; i < 2; i+
8、+)char的指针变量{B)line是一个指针变量,该变量可以指向一个长scanf("%d", p); p++; 度为5的字符型数组}C)line是一个指针数组,语句中的*号称为间址运for(i = 0; i < 3; i++)算符for (j= 0; j < 2; j++)printf(