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));
Thanks for the feedback!

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

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 do you represent a stack and a queue by using one-dimensional array?

You would not use an array for a stack or queue, you would use a singly-linked list. The problem with arrays is that they must grow and shrink as items are inserted or extract

Is it better to use malloc or calloc to allocate memory?

  Answer   In general using malloc is faster, since calloc initializes the allocated memory to contain all zeroes. If this is what you want, however, then calloc can

When do you use arrays?

It really depends on which program you write in, if you are writing a program that displays days, and months, you need string arrays. However, if you write programs that deal

Where do you use arrays?

Anywhere you want a collection of like typed items arranged in a sequential list. A character string is an example of an array of char. Do not confuse this with C++ string cl

What are the uses of array?

Array in most programming langauges like C ,C++, Java etc is a static , homogeneous and linear data structure.   A data structure itself is a mathematical and logical model

What is the uses of Arrays?

Array is nothing but data holder data holder mean variable in array we have to hold multiple values which has same data type

When you use array?

When you have more than one data-element. Example: second parameter of function main, called argv, is an array of strings. When you want to refer to a series of memory locat

Why arrays are using?

Arrays are useful for containing multiple values of the same type in a list that can be traversed forward and backward. The values in the array are stored one after another in

How do you declare 2 dimension arrays?

All arrays are one-dimensional. A two-dimensional array is simply a  one-dimensional array of one-dimensional arrays:    int a[2][3];   This is an array of 2 eleme

Why use array?

You use an array when all you really need is a sequence of data of  the same type. Arrays also offer constant-time random access,  making them the ideal container for sortin