Is it possible to store one array in another array using Delphi? Yes it is. The simpliest way to implement this is like so:
//Standard one dimensional array of Strings
AMyArray: Array[0..5] of String;
//Array containing multiple Standard one dimensional arrays
//Or in other word two dimensional array
MYArrayColection: Array[0..4] of AMyArray;
Note in order to achieve what you wan't your one dimensional array must contain 6 elements. First element stores the name of your person. Next five store the names of his/hers friends
But this is a bad design. Why?
If we look at your example Charlie, Tom and Hary can all have Jane as a fried. This means that you will be storing her name miltiple times and doing so consuming more memory.
Now with small number of pepole and smal number of firends this doesen't pose a problem but when you have large number of pepole with bigger number of friends (which you might want later) this can become a real problem since you could be wasting large amount of memor becouse of this.
First instead of storing persons information in string store it in record. This record should have Name field for storing persons name and Array of Integers for storing the friend connections. Why Array of integers?
Becouse the next thing that you should do is create an array of TPerson records in order to store pepole records.
Once you have this you first populate your pepole array with all available pepole but at this time you still don't fill the information about their friends.
After you have populated your pepole array you go and start entering the fireds information for each person. But instead of storing the friends name you simply store the index at which this friend is stored in pepole array.
So the code for this would look something like this:
//Record used to store information about individual person
TPerson = record
//Persons name field
Name: String;
//Array storing index references to persons friends
Friends: Array[0..4] of Integer;
end;
//Array storing multiple person records
Pepole: Array[0..4] of TPerson;
This is how you would get name of the first person stored in pepole array:
PersonsName := Pepole[0].Name;
This is how you would get name of the second friend of your first person stored in pepole array
SecondFriendsName := Pepole[Pepole[0].Friends[1]].Name;
This call might be a bit harder to understand.
The code inside the outher square brackets returns the index number of the friend record we are searching for.
TList<T>. Or perhaps some other structure. Kind of depends on what you intend to do with the data structure.arr[0][0]is the person, andarr[0][1]is the first friend,arr[0][2]the second friend and so on. That doesn't bring out the strong difference between person and friend.TDictionary, where you could have a key for each person and a value (an object, for instance) to contain the other data. You can then easily retrieve the data for a person by name, update it or use it, etc.