实验c语言不同类型的指针互用(不推荐只是学习用)

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Hello, world
");
    char c[4];
    int *p = NULL;
    p = (int *)(&c[0]);
    *p = 0X01020304;
    printf("%d--%d--%d--%d--",c[0],c[1],c[2],c[3]);    
    return 0;
}

结果是:4--3--2--1

指针步长,字符串占一个字节,整型变4个字节.

其他知识点 intel的大端小端

原文地址:https://www.cnblogs.com/fps2tao/p/8331421.html