I've got this sort of calculator, that operates with astronomical numbers, this is a code fragment of the menu.
What I need to accomplish is to pass or initialize that result pointer declared in main to the functions inside the menu.
The problem is that if I initialize it, for example, in the function realizarSuma(), after each iteration of the while loop it gets set to NULL again, so I can never use that result in another operation later.
int main() {
    NumeroAstronomico *result = NULL;
    int opcion;
    int finaliza = 0;
    while (finaliza == 0) {
        printf("1.Sumar valores\n2.Verificar igualdad de dos numeros\n3.Verificar menor valor\n"
               "4.Guardar resultados\n5.Cargar resultados\n6.Salir\n\n");
        printf("Opcion:");
        scanf("%d", &opcion);
        finaliza = menu(opcion, result);
    }
    return 0;
}
int menu(int opcion, NumeroAstronomico *result) {
    switch (opcion) {
        case 1:
            result = realizarSuma();
            printf("result %s\n", result->entero); //I get the correct result
            return 0;
        case 2:
            verificarIgualdad();
            return 0;
        case 3:
            obtenerMenor(result);
            return 0;
        case 4:
            printf("result %s\n", result->entero);
            guardarResultado(result);
            return 0;
        case 5:
            result = cargarResultado();
            return 0;
        case 6:
            exit(0);
        default:
            printf("Opcion Invalida, ingrese nuevamente\n");
            return 0;
    }
}
Why is this happening and how can I avoid this behaviour?
 
    