View Single Post
  #2 (permalink)  
Old December 4th, 2006, 08:13 AM
Geo121 Geo121 is offline
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

I'm not exactly familiar with the differences in C++ and visual c++ .net 2003 but the error you are getting sounds and looks like a linker error.

Now because I'm not sure what visual c++ .net 2003 does I'm not sure if you need to declare you main function as an int.

so if you use this code :

#include <iostream>

using namespace std;

int main()
{
    int *ptr;

    ptr = new int[5];

    *ptr = 5;
    ptr[1] = 10;
    ptr += 2;
    *ptr = 15;
    ptr -= 2;

    for (int i = 0; i < 5; i++)
    {
        cout << ptr[i] << endl;
    }

    delete ptr;
    return 0;
}

It should work, It does for me, but I'm not using visual c++

Sorry I can't help anymore than this

~ Geo

 ~ You are unique, just like everyone else
Reply With Quote