Q:

Struct and Arduino

I´m trying to use struct with Arduino and I´m a beginner and I don´t know how to declare an array inside the struct and use it (int pin[5] and int vecinos[6]).
typedef struct
{
  int id;
  int pin[5];
  int tiempoCero;
  int tiempoApagado;
  int estado;
  int vecinos[6];
} zonas;

zonas zona[5];

A:

Your declaration is fine. However you need to understand that Arduino IDE automatically generates function prototypes for you. Unfortunately the IDE does a poor job. It sorts the generated prototypes to the top BEFORE the declarations. Thus you can not use them in any function definitions. Unless you prevent the IDE from auto generating the prototypes.
I found three ways to achieve this:

Put your functions into a namespace and you get full control even in INO files.
Move your functions into include files
Wrap your functions into a macro such that the IDE does not recognize it as a function anymore. E.g. like the TRICK17 macro

For small files my preferred solution is #1. Your sketch would then be
namespace whatever {
    typedef struct 
    {
      int id;
      int pin[5];
      int tiempoCero;
      int tiempoApagado;
      int estado;
      int vecinos[6];
    } zonas;

    function example(zonas z) {
        ...
    }
}

void setup() { 
    ... 
}
void loop() { 
    whatever::zonas z;
    ...
    whatever::example(z);
}

For an extensive example look here.

A:

I would suggest avoiding the coding directly in the .ino files, unless it's really a few lines.
For anything else, just create separate .h and .c/.cpp files.
This will allow also to test all/part of the code by compiling and running on a PC.
Usually I have a simple project.cpp file to which i create a project.ino symlink.
Then in a separate .cpp/.h pair of files I write all the code, including entry points to call from setup() and loop().

