No se puede modificar la variable del puntero pasada como argumento a una función
Tengo esta funcion
int rt_exist(struct route_entry* prev_rte) {
prev_rte = rte_head; //This doen't assigns rte_head to prev_rte
return 0;
}
dónderte_head es una variable de puntero struct route_entry * inicializada. Pero en el caso anterior, "prev_rte" no tiene asignado el valor de rte_head.
Por cierto, si hago algo como esto
int rt_exist(struct route_entry* prev_rte) {
struct route_entry* rte_new;
rte_new = rte_head; //But this can
return 0;
}
La asignación anterior ocurre sin problemas. El problema surge cuando la variable puntero se pasa como argumento de función.
Es una pregunta extraña con pequeños detalles, pero ¿alguien puede indicarme una posible dirección o algo mal que pueda estar haciendo?