首页  >  文章  >  数据库  >  间接修改指针的地址技巧

间接修改指针的地址技巧

WBOY
WBOY原创
2016-06-07 14:59:50932浏览

// test for a pointer.cpp : Defines the entry point for the console application. // #include \"stdafx.h\" #include iostream using namespace std; typedef struct { int *p; }Test; int main( ) { int *p; // p[0] = 4; // p[1] = 3; Test test; p =

 // test for a pointer.cpp : Defines the entry point for the console application.
//
#include \"stdafx.h\"
#include
using namespace std;
typedef struct
{
 int *p;
}Test;
int main( )
{
 int *p;
//      p[0] = 4;
// p[1] = 3;

 Test test;

 p = (int *)&test;

 p[0] = 1;
 cout  cout  return 0;
}

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn