代码如下:

// struct.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

int g_Con[128] = { 0 };

typedef struct tag_Info_S
{
    int num1;
    int num2;
    double num3;
}Info_S;

int main(int argc, _TCHAR* argv[])
{
    Info_S *p = (Info_S *)g_Con;    //将int类型的数据强制转换成为Info_s

    p->num1 = 0x1;   
    p->num2 = 0x10;
    p->num3 = 0x1234.5678;      //由于类型不一致,double在写入int数组的时候会发生数字截断,输出比较奇怪

    for (int i = 0; i < 5; i++)
    {
        printf("g_Con[%d] = %0x\n", i, g_Con[i]);

    }
    return 0;
}

说明:

对于内存来说是没有类型的。