My problem is this: I want to implement a TAD that allows me to go through a data collection of type string
, entering values at the end and in the header .h I have the declaration:
typedef rep_string *coleccion;
In the .cpp file my rep_string
is a struct with 3 fields: inicio
(to restart the route), actual
(to indicate the string
pointed) and final
(to add the data )
struct nodo {
char *frase
nodo *sig;
};
struct rep_string {
nodo *inicio;
nodo *actual;
nodo *final;
};
My question is whether the statement:
coleccion aux = new rep_string;
and later, when the collection has elements, the call:
aux->inicio->frase
are correct.