I want to define a string array and it's values at the same time, like:
string mystr[2] = "zero","one","two"
or like in vb:
mystr(2) = Array("zero", "one", "two")
Is this possible?
Printable View
I want to define a string array and it's values at the same time, like:
string mystr[2] = "zero","one","two"
or like in vb:
mystr(2) = Array("zero", "one", "two")
Is this possible?
Almost right :)
Remember, there are three things in the array, so you need to put a 3 in there.Code:string mystr[3] = {"zero", "one", "two"};
oh...I thought it started with 0?
It does, but you define by the number of elements in the array.
You also dont need the value there, the compile will figure out how big the array is by the number of elements inside the curly braces.
Z.
Say you have this:
It has three things in it. The 0th thing is "bob", the 1st thing is "bill", and the 2nd is "buck".Code:string mystr[] = {"bob", "bill", "buck"};