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