My problem requires conversion of fixed Array size to dynamic memory allocation. I have tried all sorts of calloc, malloc and relloc statements but nothing seemed to work. I guess even a void *data pointer was useless.
Please convert this code for dynamic memory so that I can resize the array later. Also to add I am working with linked list so this array is a Node pointer.
Node *lists[100] //this does my job
lists[listNo] = NULL;
if I want to use malloc:
Node *lists = (Node) malloc(100*sizeof(Node));
lists[listNo] = NULL; // gives me error when I use malloc or calloc and the error is assigning Node from void*
#ifdef __cplusplus
#error wrong compiler
#endif
– pmgNode_var = pointer
); ifNode_var
is a pointer, assigning it a value of typevoid*
is ok in C – pmgvoid *
is converted to any poitner type... – Iharob Al Asimi