title: Data definition has no type or storage class
body: <p>I tried to allocate storage to a struct pointer. Here is the abreviated code - could you tell me what did I do wrong?</p>
  <p>can.h</p>
  <pre><code>#ifndef CAN_H_
  #define CAN_H_
  
  typedef struct {
    u32  id;
    u32  mask;
    char length;
    char data[8];
    char status; 
  } CAN_PACKET;
  </code></pre>
  <p>project.c</p>
  <pre><code>#include &quot;can.h&quot;
  
  CAN_PACKET *packet_Tx, *packet_Rx;
  CAN_PACKET packet1, packet2;
  packet_Tx = (CAN_PACKET*)malloc(sizeof(CAN_PACKET));      /* line 20 in text */
  packet_Tx = &amp;packet1; 
  packet_Rx = &amp;packet2;
  
  int main(void)
  {
    while(1)
    {
          }
  }
  </code></pre>
  <p>I get these errors/warnings:</p>
  <blockquote>
  <p>Warning   1   data definition has no type or storage class    c:\users\blu\documents\avrstudio\Can5\Can5\Can5.c   20  2   Can5</p>
  <p>Warning   2   type defaults to 'int' in declaration of 'packet_Tx'    c:\users\blu\documents\avrstudio\Can5\Can5\Can5.c   20  2   Can5</p>
  <p>Error 3   conflicting types for 'packet_Tx'   c:\users\blu\documents\avrstudio\Can5\Can5\Can5.c   20  2   Can5</p>
  <p>Error 4   previous declaration of 'packet_Tx' was here    c:\users\blu\documents\avrstudio\Can5\Can5\Can5.c   18  13  Can5</p>
  <p>Warning   5   initialization makes integer from pointer without a cast    c:\users\blu\documents\avrstudio\Can5\Can5\Can5.c   20  14  Can5</p>
  </blockquote>
  <p>The rest of the code complies fine when the packet_Tx assignment lines are commented out. Thanks a lot guys.</p>