当前位置:Gxlcms > mysql > 间接修改指针的地址技巧

间接修改指针的地址技巧

时间:2021-07-01 10:21:17 帮助过:43人阅读

// 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 << \"p[0] = \" << p[0] << endl;
cout << \"test.i = \" << test.p << endl;
return 0;
}

人气教程排行