c - return makes pointer from integer without a cast [enabled by default] -


does know how can resolve warning:return makes pointer integer without cast [enabled default] when return new_cost?

int *cost(int num_nodes, edge new_solution[][10]) {     int new_cost = 0;     int num_edges = 1; //set number of edges default     int x, y, weight;      (x = 1; x <= num_nodes; x++) //print out new_solution     {         weight =0;//find largest tx on each node         (y = 1; y <= num_nodes; y++)             if (new_solution[x][y].label == 1)             {                 printf("\n edge %d:(%d %d) energy:%d",                        num_edges++, x, y, new_solution[x][y].weight);                 if (weight < new_solution[x][y].weight) //find highest energy used per node                 {                     weight = new_solution[x][y].weight;                     //printf("\n weight:%d accum:%d", weight, new_cost);                 }             }         new_cost += weight; //find total weight     }     printf("\n total cost %d\n\n", new_cost);     return new_cost; } 

is because can't assign weight variable array? same warning function below returning cost. know how solve this?

int *acceptance_prob(float t, int old_cost, int new_cost, edge new_solution[][10],                       edge current_sa[][10], file *fp, int num_nodes) {     int delta = 0, x, y;     float ap = 0.0;     int cost;      delta = (old_cost - new_cost);     ap = (exp(delta/t)); //this typical equation used      if (new_cost < old_cost)//if new_solution has less energy select     {         fprintf(fp, "no");         (x = 1; x <= num_nodes; x++)             (y = 1; y <= num_nodes; y++)                 current_sa[x][y] = new_solution[x][y];         old_cost = new_cost;     }     else //if new_solution uses more energy maybe select     {         if (ap > rand_float())         {             fprintf(fp,"yes");             (x = 1; x <= num_nodes; x++)                 (y = 1; y <= num_nodes; y++)                     current_sa[x][y] = new_solution[x][y];             old_cost = new_cost;         }     }     cost = old_cost;      return cost; } 

does know how can resolve warning:return makes pointer integer without cast [enabled default] when return new_cost?

change return type of function int* int.

returning int* function not make sense anyway.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -