Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ vector declaration

vector<int> vec;
//Creates an empty (size 0) vector

vector<int> vec(2);
//Creates a vector with 2 elements.

vector<int> vec(4, 3);
//Creates a vector with 4 elements.
//Each element is initialised to 3. 
 
PREVIOUS NEXT
Tagged: #vector #declaration
ADD COMMENT
Topic
Name
3+6 =