#include <stdio.h> void main(void) { int i = 0; char str[10] = {1,2,3,4,5,6,7,8,9,10}; short *ptr = NULL; ptr = (short *)str; while(i < 10) { printf("%x ",*(ptr+i)); i++; } return ; }
不上机执行,输出结果:
#include <stdio.h> void main(void) { int i = 0; char str[10] = {1,2,3,4,5,6,7,8,9,10}; short *ptr = NULL; ptr = (short *)str; while(i < 10) { printf("%x ",*(ptr+i)); i++; } return ; }
不上机执行,输出结果: