Dynamic pointer to array of strings

This code is not the actual program, but I need this to make it work, since in the main program I will implement something similar to this. This code is to illustrate my problem:

1
2
3
4
5
6
7
  	string *trade= NULL;
	trade= new string [2];
	trade[0] = string("France");
	trade[1] = string("Spain");

	string aux1 = trade[1];
	string aux2 = trade[2];

I need aux1 to contain France and aux2 Spain, but of course this isn't the case, cause if it were, I wouldn't be asking for help.
The program never gets to actually compile. I'm sure it's a noob question but I'd love some help, I've been looking around and haven't found a similar problem so I resort to you. Thanks in advance!
You write to 0 and 1, but read from 1 and 2.
Man thanks! I've recently started using C++ again and I still have a lot of mishaps from using Matlab.
Last edited on
Topic archived. No new replies allowed.