题目:
#include <stdio.h> int main() { int arr[] = {1,2,3,4,5}; short *p = (short*)arr; int i = 0; for(i=0; i<4; i++) { *(p+i) = 0; } for(i=0; i<5; i++) { printf("%d ", arr[i]); } return 0; }
分析:
结果:
因此输出的结果为: 0 0 3 4 5
#include <stdio.h> int main() { int arr[] = {1,2,3,4,5}; short *p = (short*)arr; int i = 0; for(i=0; i<4; i++) { *(p+i) = 0; } for(i=0; i<5; i++) { printf("%d ", arr[i]); } return 0; }
因此输出的结果为: 0 0 3 4 5