I’m confused regarding the use of “with” and “of”.
Should I use “array with objects” or “array of objects”?
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.Sign up to join this community
"Array of elements" denotes that the array is made up of the elements.
"Array with elements" denotes that the array is found with or alongside some elements. This can be used much like "with" in other contexts to refer to traits of the array or partial content.
"A string in computer science is an array of characters."
"The string 'Bubba' is an array with a 'u' in it."
"This is an array with labels for each value."
"This array is anonymous."
It really depends on how you're using it. For example "He displayed an array with objects from all of the ships involved, in order to honor those involved in one of the greatest naval actions ever". Or you could say "There was an array of objects from the ships involved, the better to honor those who participated in the Battle of Trafalgar".