Originally Posted By: txesmi
Originally Posted By: Florastamine

Code:
STRING **array = (STRING *) sys_malloc(sizeof(STRING) * N);



This code line is wrong. It allocates N times the length of a STRING struct!

It should be:
Code:
STRING **array = (STRING**) sys_malloc(sizeof(STRING*) * N);



that allocates N times the length of a pointer to a STRING struct.

Salud!


Yeah, I forgot about the extra asterisk! Because it's a pointer to pointer, you should allocate memory for the pointers.

Thanks for pointing it out!

Last edited by Florastamine; 12/12/15 04:19.