user8726: I'm having some difficulty assigning a value to a variable in a struct array outside the loop and setup functions. Assigning a value to an int or char array works completely fine but this doesn't. 
The example code and error message returned after trying to compile are below. Any help is greatly appriciated. Thanks
void setup()
{
}

struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
} trap_game_details[2];

trap_game_details[0].random_min = 1;

void loop()
{

}

src/sketch.ino:13:5: error: ‘trap_game_details’ does not name a type
     trap_game_details[0].random_min = 1;
     ^
.build/uno/Makefile:166: recipe for target '.build/uno/src/sketch.o' failed

user4143: You can't access array contents in the global scope like that.  You have to assign the entire block of data in one go:
struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
};

struct trap_game_details trap_game_details[2] = {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
};

Items in the global scope aren't executed - only things in functions are executed.  Accessing individual parts of an array or struct like you are trying to is a programatic operation, so can't be executed since it's not in a function.

user10794: 
Assigning a value to an int or char array works completely fine but this doesn't. 

It only works fine if you do it on the declaration.
eg.
This works:
int foo = 42;  < ---- declare and define with initial value

This doesn't:
int foo;   // < ---- declare and define

foo = 42;  // < ---- assignment statement

Your code was like the second example.

Majenko has shown one way. He split the declaration into two parts. The first part declared the type trap_game_detail, and the second part is an instance of that type, like this:
struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
};

struct trap_game_details trap_game_details[2] = {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
};


Alternatively, and a bit closer to what you were doing, just keep going with the initialization values after you define the structure, like this:
struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
} trap_game_details[2] =  
  {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
  }; 


8726: <p>I'm having some difficulty assigning a value to a variable in a struct array outside the loop and setup functions. Assigning a value to an int or char array works completely fine but this doesn't. </p>

<p>The example code and error message returned after trying to compile are below. Any help is greatly appriciated. Thanks</p>

<pre><code>void setup()
{
}

struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
} trap_game_details[2];

trap_game_details[0].random_min = 1;

void loop()
{

}
</code></pre>

<p>src/sketch.ino:13:5: error: ‘trap_game_details’ does not name a type
     trap_game_details[0].random_min = 1;
     ^
.build/uno/Makefile:166: recipe for target '.build/uno/src/sketch.o' failed</p>
 4143: <p>You can't access array contents in the global scope like that.  You have to assign the entire block of data in one go:</p>

<pre><code>struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
};

struct trap_game_details trap_game_details[2] = {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
};
</code></pre>

<p>Items in the <em>global scope</em> aren't executed - only things in functions are executed.  Accessing individual parts of an array or struct like you are trying to is a programatic operation, so can't be executed since it's not in a function.</p>
 10794: <blockquote>
  <p>Assigning a value to an int or char array works completely fine but this doesn't. </p>
</blockquote>

<p>It only works fine if you do it on the declaration.</p>

<p>eg.</p>

<p>This works:</p>

<pre><code>int foo = 42;  &lt; ---- declare and define with initial value
</code></pre>

<p>This doesn't:</p>

<pre><code>int foo;   // &lt; ---- declare and define

foo = 42;  // &lt; ---- assignment statement
</code></pre>

<p>Your code was like the second example.</p>

<hr>

<p>Majenko has shown one way. He split the declaration into two parts. The first part declared the <strong>type</strong> trap_game_detail, and the second part is an <strong>instance</strong> of that type, like this:</p>

<pre><code>struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
};

struct trap_game_details trap_game_details[2] = {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
};
</code></pre>

<hr>

<p>Alternatively, and a bit closer to what you were doing, just keep going with the initialization values after you define the structure, like this:</p>

<pre><code>struct trap_game_detail {
    byte flush_quantity;
    byte flush_interval;
    byte random_min;
    byte random_max;
    byte random_quantity;
} trap_game_details[2] =  
  {
    { 10, 5, 1, 100, 4 },
    { 8, 23, 5, 95, 8 }
  }; 
</code></pre>
