I am trying to use below piece of code from sflowtool.c in C++ Builder community edition but receiving Access Violation. 

```
uint32_t TForm3::getData32_nobswap(SFSample *sample)
{
    uint32_t ans = *(sample->datap)++; // HERE I GET THE ERROR

  if((uint8_t *)sample->datap > sample->endp) {
    SFABORT(sample, SF_ABORT_EOS);
  }
  return ans;

```

Before &sample is passed to above function, it has this

```
    SFSample sample;
    memset(&sample, 0, sizeof(sample))
    sample.rawSample = (uint8_t *) AData[0];
    sample.datap = (uint32_t *) sample.rawSample;
    sample.endp = (uint8_t *) sample.rawSample + sample.rawSampleLen;
    sample.datagramVersion = getData32(&sample);

```

where AData is of type "const TIdBytes AData"

Can anybody give me some pointers to understand the reason ? iS there any difference c++ handles above code as compare to C ?