title: How to get the value of a pointer in C++/CLI?
body: <p>Native C++ cpp file：</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  int strcpyTest(int dest, int *sour)
  {
      int s = dest + 10;
      std::cout &lt;&lt; "s" &lt;&lt; s &lt;&lt; std::endl;
      std::cout &lt;&lt; "&amp;s" &lt;&lt; &amp;s &lt;&lt; std::endl;
      sour = &amp;s;
      int x = *sour + 20;
      std::cout &lt;&lt; "sour" &lt;&lt; sour &lt;&lt; std::endl;
      std::cout &lt;&lt; "*sour" &lt;&lt; *sour &lt;&lt; std::endl;
      return x;
  }
  </code></pre>
  
  <p>C++/CLI h file:</p>
  
  <pre><code>#pragma once
  using namespace System;
  using namespace System::Runtime::InteropServices;
  namespace SubFunction {
      public ref class Test
      {
      public:
          int StrTest(int d);
          int xxx;
      };
  }
  </code></pre>
  
  <p>C++/CLI cpp file:</p>
  
  <pre><code>#include "stdafx.h"
  #include "CPlusPlus.h"
  #include "SubFunction.h"
  int SubFunction::Test::StrTest(int d)
  {
      int x;
      int dd = strcpyTest(d, &amp;x);
      xxx = x;
      return dd;
  }
  </code></pre>
  
  <p>C# cs file:</p>
  
  <pre><code>int a = 15;
  Test ts = new Test();
  int x = ts.StrTest(a);
  int y = ts.xxx;
  MessageBox.Show(x.ToString());
  MessageBox.Show(y.ToString());
  </code></pre>
  
  <p>In the final MessageBox, "xxx" is a pointer address. For the first time, "xxx" has a pointer address value. If it is calculated again, it always appears 0. Why? I don't understand. How to get the value? Or get the value of "sour"?</p>