Hi
I'm working with a structure like this:
struct table{
int id, rank, hop_sup;
float dist,bs_dist, res_enrg, total;
};
struct nd{
float x,y, enrg, bsdist;
int id,my_rank, hop;
int neighbor[50], prfrdnbor;
float nbordist[50];
struct table nbr[25];
}node[127];
Do you think this would cause memory problem?
In my program, in one code segment, the program looks like this:
int po,to=0,mo=0, fl;
for(po;po<127;po++)
{
if(node[po].neighbor[to]!=0)
while(node[po].neighbor[to]!='\0')
{
fl=node[po].neighbor[to];
node[po].nbr[mo].id=fl;
node[po].nbr[mo].rank=node[fl-1].my_rank;
node[po].nbr[mo].res_enrg=node[fl-1].enrg;
node[po].nbr[mo].dist=copy_dist[po][fl-1];
node[po].nbr[mo].bs_dist=node[fl-1].bsdist;
node[po].nbr[mo].total=pow(node[po].nbr[mo].res_enrg,-1)+ node[po].nbr[mo].dist+node[po].nbr[mo].bs_dist;
mo++;
to++;
}//eo while
mo=0;
to=0;
}//eo for
I already initialized x,y,enrg, bsdist,id,my_rank etc in structure nd by some calculation. But the above code segment producing wrong and strange result. Can u guess whts happenning?