Int pointer : Pointer « Data Type « Visual C++ .NET






Int pointer

 

#include "stdafx.h"
using namespace System;

value class Test 
{
public:
    int i; 
};

#pragma unmanaged

void incr (int *i)
{
    (*i) += 10;
}

#pragma managed

void main () 
{
    Test ^test = gcnew Test();
    interior_ptr<int> ip = &test->i;
    (*ip) = 5;


    pin_ptr<int> i = ip;  

    incr( i );             
                                
    Console::WriteLine ( test->i );
}

   
  








Related examples in the same category

1.Address Indirect
2.Pointer To String Chars
3.Int Pointer with gcnew
4.Int Pointer Arithematic
5.Using pointer arithmetic on the interior pointer