How to write array of structures in Yang?

I want to write yang for the following C structure:
typedef struct b{
int aa;
bool flag;
char bb;
}B;
typedef struct a{
B variableb;
}A;
typedef struct devices{
A variablea[10];
}Devices;

Well, I’m not sure that mapping C data structures directly to YANG is very useful in most cases, but anyway: The YANG equivalent of an array of structs in C is a list. And since lists are not limited to integral indices, and the names of the indices are needed in at least the XML encoding, the keys of a list must be explicitly defined. So maybe something like this for your example:

  container devices {
    list variablea {
      key index;
      leaf index {
	type uint8;
      }
      container variableb {
	leaf aa {
	  type int32;
	}
	leaf flag {
	  type boolean;
	}
	leaf bb {
	  type uint8;
	}
      }
    }
  }

If you want to be able to reuse the definitions of the list and its parts, like your C typedefs allows for, you can use the YANG grouping and uses statements.