Home  >  Article  >  Database  >  间接修改指针的地址技巧

间接修改指针的地址技巧

WBOY
WBOYOriginal
2016-06-07 14:59:50935browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn