I want to create a two-dimensional dynamic array in which the element will be an array of char characters (also dynamic) ... how to implement it?
void making_an_array(int**&p_arr, int const rows, int const cols) { p_arr = new int*[rows]; for (int i = 0; i < rows; i++) p_arr[i] = new int[cols]; } here the function creates a two-dimensional array int and in my element will be char ... how to be?
void create_a_string_element() { int symbol_number{}; int string_size = rand() % 5 + 5; char *string_element = new char[string_size + 1]; for (int j = 0; j <= string_size; j++) { symbol_number = rand() % 32 + 192; if (j == string_size) string_element[j] = '\0'; else string_element[j] = symbol_number; } delete[]string_element; } and here I create my element. Engaged in self-education
Int first, second; fd = new char**[first]; for(int i = 0; i<first; i++) fd[i] = new char*[second];I can not guarantee the exact syntax, wrote in haste on the phone - Vladimir Afanasyev