like this : int (*arr)[M] = malloc(sizeof(int[N][M]));
arr
is pointer to int[M]
.
use like arr[0][M-1];
and free(arr);
More Related Contents:
- A different way to malloc a 2D array?
- Freaky way of allocating two-dimensional array?
- GCC: Array type has incomplete element type
- How to access 1 element in 2D dynamic array in C++
- How do I take values from text file and input into a 2D array? c++
- How do I use arrays in C++?
- Passing a 2D array to a C++ function
- What does the range method getValues() return and setValues() accept?
- Map a 2D array onto a 1D array
- Array to pointer decay and passing multidimensional arrays to functions
- Loop over array dimension in plpgsql
- How do I best handle dynamic multi-dimensional arrays in C/C++?
- How to use realloc in a function in C
- A pointer to 2d array
- How to initialize 3D array in C++
- How to get a dimension (slice) from a multidimensional array
- Getting the size of a malloc only with the returned pointer
- How is the array stored in memory?
- How to print 2D Arrays in C++?
- Manipulate multidimensional array in a function
- C++ 2 dimensional array with variable size rows
- Translating C function with args to MIPS: loop over an int array and count negatives
- C# multidimensional arrays iteration
- What is the safe way to fill multidimensional array using std::fill?
- In C/C++, is char* arrayName[][] a pointer to a pointer to a pointer OR a pointer to a pointer?
- How do I iterate through each element in an n-dimensional matrix in MATLAB?
- Variable Sized Arrays vs calloc in C
- Malloc and array index confusion in C
- 2D Array indexing – undefined behavior?
- How to copy a row of values from a 2D array into a 1D array?