queue q;
float A[2][3] = {{0, 1, 2}, {10, 20, 30}};
printf("Value from array %f\n", A[1][0]);
q.push( (float*) A );
printf("Array A added to the queue \n");
printf("Value from the queue %f\n", ((float**)q.front())[1][1]);
Я хочу манипулировать очередью многомерного массива (матрицы), меня не интересует std, поскольку мой кросс-компилятор не полностью поддерживает C++20 [code]queue q; float A[2][3] = {{0, 1, 2}, {10, 20, 30}}; printf("Value from array %f\n", A[1][0]); q.push( (float**) A ); printf("Array A added to the queue \n"); printf("Value from the queue %f\n", q.front()[1][1]); float el2[2][3] = {{1.5, 1.6, 0.7}, {2.5, 2.6, 2.7}}; [/code] Вот результат: [code]Value from array 10.000000 Array A added to the queue Segmentation fault (core dumped) [/code] Я также пробовал с очередью q; [code]queue q; float A[2][3] = {{0, 1, 2}, {10, 20, 30}}; printf("Value from array %f\n", A[1][0]); q.push( (float*) A ); printf("Array A added to the queue \n"); printf("Value from the queue %f\n", ((float**)q.front())[1][1]); [/code] Я получаю нормальный результат