ホームページ  >  記事  >  データベース  >  间接修改指针的地址技巧

间接修改指针的地址技巧

WBOY
WBOYオリジナル
2016-06-07 14:59:50935ブラウズ

// 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 までご連絡ください。