i am trying to allocate memory for integer but i get a warning assignment makes integer from pointer without a cast and when i do a cast for an int i get a warning cast from pointer to integer of different size
here is my code for first :
int i;
for(i = 0 ; i < gNumOfAllFiles ; i++)
{
int *v=(int *)malloc(1*sizeof(int));
v=0;
dependencies[i].visited =(int)v;
}
or
dependencies[i].visited =v
The dependencies[i] is a struct contains field int visited and i am trying to initilize it by 0
*v = 0. Reading from a pointer:visited = *v.malloc()!gNumOfAllFilesis 1000, you'll allocate 1000 ints, but never free them. For eachmalloccall, there has to be afreeto match it