[ create a new paste ] login | about

Link: http://codepad.org/frysgQte    [ raw code | fork ]

C, pasted on Nov 30:
#include <stdint.h> // uint8_t
#include <string.h> // memset

/* NEED A node_id TYPE IN SCOPE */
typedef int node_id;

typedef struct
{
  void *head;           // TYPE CHANGED FROM (RF12Head) to (void*)

  union                 // NO typedef HERE
  {
    uint8_t raw[40];

    struct              // NO typedef HERE EITHER
    {
      node_id nodeId;
      uint8_t hierachyDepth;
    } MessageNodeFound;
  } data;

} RF12Message;

int main(void) {
  RF12Message msg;

  memset(&msg.data.raw, 0xEF, sizeof(msg.data.raw)); // fill in directly
  // or indirectly:
  msg.data.MessageNodeFound.nodeId = 3;
  msg.data.MessageNodeFound.hierachyDepth = 2;
  return 0;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: