Good, I need to create a header with an array of structures and a .cpp where the methods are implemented, and it has to have a struct, and create an array of that struct, and then from another file create that array and make the operations with the same, is a kind of table that contains a name, a type and a value in the .h I have:
#ifndef TABLA_H
#define TABLA_H
union dato
{
int entero;
float real;
int booleano;
};
typedef struct mitabla {
std::string Nombre;
int Tipo;
dato Valor;
};
mitabla tablasimb[10];
extern void nuevavarentera(int cont,std::string nombre,int tipo,int valor);
#endif
in table cpp at the moment a single method to try:
#include "tabla.h"
void tabla :: nuevavarentera(int cont,std::string nombre,int tipo,int valor){
std::transform(nombre.begin(), nombre.end(), nombre.begin(), ::toupper);
tablasimb[cont].Nombre=nombre;
tablasimb[cont].Tipo=tipo;
tablasimb[cont].Valor.entero=valor;}
and in the main file in the main I want to create it but I can not:
int main(int argc, char** argv){
tabla mitabla;
mitabla.nuevavarentera(0,"mivariable",0,2);
}
Some idea of how to create this array of structures in the header and create it from the main in another file (I do the includes "tabla.h")