Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Dynamic memory allocation of 2D array

Status
Not open for further replies.

bhadmanathan

Junior Member level 1
Junior Member level 1
Joined
May 7, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
187
Hello experts,
I am having some doubts in Dynamic allocation of 2D array..

I understood the allocation using array of pointers.

int *arr[r];
for (i=0; i<r; i++)
arr = (int *)malloc(c * sizeof(int));

but having doubts in pointer to pointer..

int **arr = (int **)malloc(r * sizeof(int *));
for (i=0; i<r; i++)
arr = (int *)malloc(c * sizeof(int));

I dont understand what (int **arr) comes to tell...


Thanks in advance
 

if you do a web search for "malloc 2D array" you will get many links code examples and to discussions of problems
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top