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






Int Pointer Arithematic

 
#include "stdafx.h"
using namespace System;

void main()
{
    array<int>^ primes = gcnew array<int> {1,2,3,5,7,11,13,17};

    interior_ptr<int> ip = &primes[0];       

    int total = 0;
    while(ip != &primes[0] + primes->Length) 
    {
        total += *ip;
        ip++;                                
    }

    Console::WriteLine(total);
}

   
  








Related examples in the same category

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