Answer to Question #9080 in C++ for M. Javed Iqbal

Question #9080
how we can use dynamically allocated two-D array in tokenization
1
Expert's answer
2012-11-12T06:13:28-0500
1)Initialize at the beginning:
double **queryPoint = 0;
int qp_count = 0;
2)For every line call:
// call realloc to make the space for points larger by one element
queryPoint = realloc(queryPoint, sizeof(double*)*(qp_count+1));
// allocate space for the new point
queryPoint[qp_count] = malloc(sizeof(double)*2);
// increase the point count
qp_count++;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS