array of both string and int

How do i make an array with one column string and one column int?

this is kind of a homework question, but the actual homework part is sorting the info and using pointers, but i understand if you guys choose not to answer.
An array can only be an array of one type. If you need to store pairs of values, consider a struct, and make an array of them

1
2
3
4
5
6
7
struct someObject
{
  int x;
  string y;
}

someObject arrayOfThem[10];


closed account (zb0S216C)
You can't store two types inside the same piece of memory such as an array. I can think of a few ways to implement what you need, but I don't know your constraints.

Wazzak
Last edited on
Topic archived. No new replies allowed.