title: Declaring a prototype of type "struct" - C
body: <p>I've been racking my brains on this for a while, I'm simply trying to create a method that returns a struct as I wish to return two int's.</p>
  
  <p>My prototype for the method is as follows:</p>
  
  <pre><code>typedef struct RollDice();
  </code></pre>
  
  <p>Also the method itself:</p>
  
  <pre><code>typedef struct RollDice()
  {
   diceData diceRoll;
  
   diceRoll.dice1 = 0;
   diceRoll.dice2 = 0;
  
   return diceRoll;
  }
  </code></pre>
  
  <p>The compiler shows the error: <code>"Syntax error: ')'"</code> for both the prototype and actual method.</p>
  
  <p>The struct itself:</p>
  
  <pre><code>typedef struct
  {
   int dice1;
   int dice2;
  }diceData;
  </code></pre>
  
  <p>Is it obvious where I'm going wrong? I've tried everything I can think of.</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit/Solution:</strong></p>
  
  <p>To get the program to work with the suggested solutions I had to make the following changes to the struct,</p>
  
  <pre><code>typedef struct diceData
      {
       int dice1;
       int dice2;
      };
  </code></pre>