R
R
Ribachok2020-07-07 11:08:53
C++ / C#
Ribachok, 2020-07-07 11:08:53

How to correctly define a variable with a vector type?

I need to make a vector of game objects that will grow later. Here I declare a vector and its 0 element, but this entry gives an error.

Can you suggest how to write it correctly?

vector<Object> objects[1];
  objects[0] = Object("models/tree.png", 600, 1000, 93, 178);


The vector header in the code is connected.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Pokrovsky, 2020-07-07
@Ribachok

// vector<Object> objects[1]; - это что?
vector<Object> objects; // так правильно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question