Chathu said:
Hello everyone!
Can anyone explain the meaning of these two code fragments.
1). int **p;
declare p as pointer to pointer to int.
p=(int**)malloc(sizeof(int *));
clearer and less error prone:
p = malloc(sizeof *p);
try to dynamically allocate storage of the size of the type p points to
(pointer to int) and assign the return value to p.
This value has to be checked against NULL as malloc() may have failed.
When you no longer need p or the storage it points to, you have to
free(p);
Please read comp.lang.c FAQ for more information.
http://www.eskimo.com/~scs/C-faq/top.html
Declare p as a function pointer, pointing to functions with empty
parameter list and no return value.
-Michael