Search
 
SCRIPT & CODE EXAMPLE
 

CPP

empty 2d array as a member of a class class c++

class Screen {
    private:
        char **data;
        int rows;
        int columns;

    public:
        Screen(int num_rows, int num_cols); 
}; 

Screen::Screen(int num_rows, int num_cols) {
    data = new char * [num_rows];
    for (int i = 0; i < num_rows; ++i) {
        data[i] = new char[num_cols];
    }
    rows = num_rows;
    columns = num_cols;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: Runtime error(Exit status:153(File size limit exceeded)) c++ 
Cpp :: C++ Vector Initialization method 01 
Cpp :: 2000pp pp play osu std 
Cpp :: how to move your chrector in unity 
Cpp :: c++ thread id 
Cpp :: c++20 inizialize a thread 
Cpp :: GoPro camera for kids aus 
Cpp :: what is require to run min max function on linux in cpp 
Cpp :: inorder to postorder converter online 
Cpp :: second smallest element using single loop 
Cpp :: cpp cout more than 1 value 
Cpp :: Calcular el número mayor y menor C++ 
Cpp :: labs c++ 
Cpp :: fabs in c++ example 
Cpp :: c++ unordered set count 
Cpp :: c++ How to not use friend declaration when equipping a class with `operator<<` 
Cpp :: pass address to function c++ 
Cpp :: c + + to c converter 
Cpp :: C++ Features 
Cpp :: changing key bindings in visual code not working 
Cpp :: c++ format number thousands separator 
Cpp :: namespace c++ 
Cpp :: how to input a file path in c++ 
Cpp :: Marin and Anti-coprime Permutation codeforces solution in c++ 
Cpp :: c++ login 
Cpp :: online c++ compiler 
Cpp :: main function 
Cpp :: size of set c++ 
Cpp :: can derived class access private members 
Cpp :: how to find maximum value in c++ 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =