void Graph::criteriaSort () const
{
int * node_list;
NodeSet s (node_num);
struct criteria
{
char c;
int node_group;
int * node_list;
//node_list = new int [node_num];
} v[node_num];
int i=1;
count = 0;
while(neighborCount(i)>=1)
{
node_list = newint [node_num];
int k = 0;
for(int nb = s.firstMember();nb;nb=s.nextMember(nb))
{
if(neighborCount(nb)>=(node_num/2*i) && neighborCount(nb)<(node_num/i))
{
v[i].node_group = i;
v[i].node_list[k] = nb;
k++;
}
}
count = i++;
}
int * neighbors;
struct info
{
char color;
int * neighbors;
} n[node_num];
neighbors = newint [node_num];
for(int y=1;y<=node_num;y++) // Set all nodes to white
{
n[y].color = 'w';
n[y].neighbors = neighborSet(s,y,1) ;
}
int m;
int q = 1;
while(q < count) // covering each node_group
{
for(int j=0;j;j++) // change the color of all the nodes in the node_list to black
{
m = v[q].node_list[j];
if(n[m].color == 'w') //check if the node is already gray or black
{
n[m].color = 'b';
}
if(n[m].color == 'g' || 'b')
{
int *h= n[m].neighbors;
int p = sizeof(h)/sizeof(* h);
for(int l=0;l<p;l++) // change the color of neighbors of each node in the node_list to gray
{
int o = h[l];
if(n[o].color == 'w') // check if any of the neighbor's is white
{
n[o].color = 'g';
n[m].color = 'b';
}
}
}
}
q++;
}
for(int z=1;z<=node_num;z++) // Set all nodes to white
{
if(n[z].color == 'b')
{
printf("%d\n", z);
}
}
}
You call the function on line 43: n[y].neighbors = neighborSet(s,y,1) ;
On line 36 I see that the lvalue is an int*: int * neighbors; so I guess neighborSet() should return a pointer to an integer.