メモリの最初の部分を他のブロックへのポインタ配列として持つ1つの関数呼び出しで、メモリの連続ブロックを作成しようとしています。コンパクトポインタを使用したいのですが、この関数は添字表記で動作します
Type **TwoD(size_t rows, size_t cols)
{
Type **p1, **prows, *pcol;
p1 = (Type **)malloc(rows * sizeof(Type *) + rows * cols * sizeof(Type));
// ??? something wrong here ??? I'd rather use this style if possible
//
//index notation works
return prows;
}