考虑下面的C程序段。
null
# include <stdio.h> int main( ) { char s1[7] = "1234" , *p; p = s1 + 2; *p = '0' ; printf ( "%s" , s1); } |
程序将打印什么?
(A) 12
(B) 120400 (C) 1204 (D) 1034 答复: (C) 说明:
char s1[7] = "1234", *p; p = s1 + 2; // p holds address of character 3 *p = '0' ; // memory at s1 + 3 now becomes 0 printf ("%s", s1); // All characters are printed
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END