Search
 
SCRIPT & CODE EXAMPLE
 

CPP

length of 2d array c++

int rows = sizeof(arr) / sizeof(arr[0]); // returns rows
int col = sizeof(arr[0]) / sizeof(int); // returns col
Comment

how to get size of 2d vector in c++

myVector[
  Vector[0, 4, 2, 5],
  Vector[1, 4, 2]
];

/*When you call for myVector[1].size() it would return 3 and [0] would return 4.

For the amount of rows (int vectors) in the 2d vector, you can just use myVector.size()

You can run this to see it in actions*/
Comment

PREVIOUS NEXT
Code Example
Cpp :: convert decimal to binary in c++ 
Cpp :: sort index c++ 
Cpp :: reverse function in cpp string 
Cpp :: delete dynamic array c++ 
Cpp :: cin.getline 
Cpp :: uses of gamma rays 
Cpp :: checking if a string has only letters cpp 
Cpp :: cpp pushfront vector 
Cpp :: remove from vector by value c++ 
Cpp :: C++ Volume of a Cylinder 
Cpp :: pascal triangle using c++ 
Cpp :: swap elements array c++ 
Cpp :: draw rectangle opencv c++ 
Cpp :: untitled goose game 
Cpp :: how do you wait in C++ 
Cpp :: stl vector 
Cpp :: c++ struct 
Cpp :: sort vector of strings 
Cpp :: c++ contains 
Cpp :: how to initialize vector 
Cpp :: how can we create 4 digit random number in c++ 
Cpp :: print counting in c++ 
Cpp :: vector c++ 
Cpp :: SUMOFPROD2 
Cpp :: resize string c++ 
Cpp :: how to make a square root function in c++ without stl 
Cpp :: break statement in c++ program 
Cpp :: linked list cycle c++ 
Cpp :: c++ std string to float 
Cpp :: glm has no member value_ptr 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =