Problem with Pointer object in C++
<p>I have a very simple class that looks as follows:</p>

<pre><code>class CHeader
{
public:
  CHeader();
  ~CHeader();
  void SetCommand( const unsigned char cmd );
  void SetFlag( const unsigned char flag );
public:
  unsigned char iHeader[32];    
};

void CHeader::SetCommand( const unsigned char cmd )
{
    iHeader[0] = cmd;
}

void CHeader::SetFlag( const unsigned char flag )
{
    iHeader[1] = flag;
}
</code></pre>

<p>Then, I have a method which takes a pointer to CHeader as input and looks
as follows:</p>

<pre><code>void updateHeader(CHeader *Hdr)
{

   unsigned char cmd = 'A';
   unsigned char flag = 'B';

   Hdr-&gt;SetCommand(cmd);
   Hdr-&gt;SetFlag(flag);
   ...
}
</code></pre>

<p>Basically, this method simply sets some array values to a certain value.</p>

<p>Afterwards, I create then a pointer to an object of class CHeader and pass it to
the updateHeader funtion:</p>

<pre><code>CHeader* hdr = new CHeader();
updateHeader(hdr);
</code></pre>

<p>In doing this, the program crashes as soon as it executes the Hdr->SetCommand(cmd)
line. Anyone sees the problem, any input would be really appreciated </p>
