一种赋值方式

来源:互联网 发布:linux中怎么复制文件 编辑:程序博客网 时间:2024/05/21 15:44
#include "stdafx.h"

int g_Con[128] = { 0 };

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

int _tmain(int argc, _TCHAR* argv[])
{
 Info_S *p = (Info_S *)g_Con;

 p->num1 = 10;
 p->num2 = 100;

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

 }
 return 0;
}


结果输出:

0 0
原创粉丝点击