I have a struct like this:
typedef struct{
char *lexema;
int comp_lexico;
union{
double v;
double (*fnctptr)();
} valor;
}tipoelem;
struct celda {
tipoelem info;
struct celda *izq, *der;
};
typedef struct celda * abb;
Then I define a global variable abb, which has a global scope. If I get somehow the memory direction of the field info of celda, would I be able to modify it safely or It is better to define the field as a tipoelem pointer such as (tipoelem *info)?
The thing is, is it safe to edit the tipoelem info field with a tipoelem *pointerToInfo from other part of the prrogram or it is better to declare it as a pointer tipoelem *info in the struct celda?
Edited with more information:
The way I want to modify tipoelem info is the next one, and I do not know if it is safe.
abb a;
int main(){
tipoelem *ptr = a->info;
ptr->comp_lexico = 2;
}
typedef.