Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to create array with not constant size in cpp

size_t n;
std::cin >> n;
int* arr = new int[n];
...
// Control flow must reach exactly one corresponding delete[] !!!
delete[] arr;
Comment

how to create array with not constant size in cpp

size_t n;
std::cin >> n;
auto arr = std::make_unique<int[]>(n);
Comment

PREVIOUS NEXT
Code Example
Cpp :: terminal compile c++ 
Cpp :: opencv c++ image write 
Cpp :: c++ random number within range 
Cpp :: find in string c++ 
Cpp :: C++ string initialization 
Cpp :: memset in c++ 
Cpp :: segmented sieve of Eratosthenes in cpp 
Cpp :: max_element c++ 
Cpp :: c++ factorial 
Cpp :: How to find the suarray with maximum sum using divide and conquer 
Cpp :: c++ for else 
Cpp :: change int to string c++ 
Cpp :: min element in stl c++ 
Cpp :: combine two vectors c++ 
Cpp :: delete from front in vector c++ 
Cpp :: reverse function in cpp string 
Cpp :: c++ string element access 
Cpp :: cpp loop through object 
Cpp :: loop through array c++ 
Cpp :: c++ modulo positive 
Cpp :: min in c++ 
Cpp :: how do you wait in C++ 
Cpp :: hexadecimal or binary to int c++ 
Cpp :: sleep in c++ 
Cpp :: c++ add two char together 
Cpp :: print two dimensional array c++ 
Cpp :: function overloading in c++ 
Cpp :: c++ doubly linked list 
Cpp :: factorial in c++ using recursion 
Cpp :: c++ reverse part of vector 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =