扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
using namespace System; int _tmain() { int ^ hnd = gcnew int(100); int* np = &hnd; // Genarates a compile error } |
#include "stdafx.h" #include <stdio.h> using namespace System; using namespace stdcli::language; int _tmain() { const int SIZE = 10; array<int>^ arr = gcnew array<int>(SIZE); for(int idx = 0; idx < SIZE; idx++) { arr[idx] = idx + 1; } // 取得指向数组第一个元素的指针 interior_ptr p = &arr[0]; // 通过增加指针值读取并输出数组元素 for(int idx = 0; idx < 10; idx++) { printf("Value of the element at %Xh ", p); Console::WriteLine(" is {0}",*(p++)); } Console::ReadLine(); } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。