您好,欢迎来到保捱科技网。
搜索
您的当前位置:首页间接修改指针的地址技巧

间接修改指针的地址技巧

来源:保捱科技网


// 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;
}

Copyright © 2019- baoaiwan.cn 版权所有 赣ICP备2024042794号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务