What would you like to do?

How do you declare an N-Dimensional array using Malloc?

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

#include <stdlib.h>
int **array1 = malloc(nrows * sizeof(int *));
for(i = 0; i < nrows; i++)
array1[i] = malloc(ncolumns * sizeof(int));
73 people found this useful
Thanks for the feedback!

How to use free with respect to malloc?

  Answer     If malloc() returns a pointer to space for an object of size size1(or NULL if the request cannot be satisfied) when invoked that returned pointer c

Use of malloc and calloc?

 The use of malloc and calloc is dynamic memory allocation. malloc allocates memory in bytes whereas calloc allocates memory in blocks. calloc initializes the allocated memo

How string array declared in c?

  There is no data type string in C. String is handled as an array of characters.   To identify the end of the string, a null character is put. This is called a null te

Give the syntax to declare two dimensional array using array of pointers?

It is not possible to declare a two-dimensional array using an array of pointers in any programming language, but many programming languages support declarations of N-dimensio

How do you use 2-D array with malloc?

You use a 2-D array with malloc the same way you use any other structure or scalar with malloc. The malloc library call takes a single argument of type size_t (in bytes) and r

Declare a one-dimensional array 'num' of type int and a two-dimensional array 'matrix' of type float digrammatically explain those arrays?

// one dimensional array 'num' of type int... int num[100]; {Sorry, diagrams are not possible in wiki.answers.com, you have to use words} This is 100 copies of an integer

How arrays are declared?

A simple formula to declare arrays in C++ is as: 1. For 1D or one dimensional array: data_type name_of_array [size_of_array] ; For example, if I want to declare a 1D ar

How do you declare a two dimensional array?

There are two types of arrays: static and dynamic. A two dimensional array is one array, each element of which consists of another array. Declaring a two-dimensional static

How you use malloc function in c?

void* malloc (size_t bytes); This means that malloc takes an argument which is the size of memory to allocate and returns a pointer to that memory which has been allocated.

How do you declare an array on Pascal?

type   array-identifier = array[index-type] of element-type;    array-identifier : the name of your array   index-type : any scaler except real   element-ty