0

I want to create 2 dimensional array of pointers in c

some code

typedef void* element;
..
..
..
//reading n,m from user
//creating the element matrix
element** newMat = (element**)malloc(sizeof(element)*n*m)

and hoping to get something that will work in

newMat[5][3];

i know this syntax wont work, any idea what can work? the best thing i got working is an array for each row, but im looking for something cleaner

JohnnyF
  • 1,053
  • 4
  • 16
  • 31

0 Answers0