I have a pointer to my char array like this.
unsigned char *recvBuf;
recvBuf = (unsigned char *)malloc(sizeof(char)*RECVBUF);
I then pass that to a function defined as
void setHeader(MyHeader *myHeader, unsigned char *buffer)
Which copies the first 12 bytes into a struct
Then I try and pass it to another function later on
Record readRecord(unsigned char *buffer, int *arrayPosition, int buffsize)
But the program always becomes unresponsive when I try and access any part of the array using [], in the exact same way it was used in the previous functiom. And i m also fine to access it like that before i pass it to the function.
Ideas would be much appreciated.
Thanks
EDIT:
Pointers are the same.
This is inside the second function
I added this code to the top and it works just fine
int k = *arrayPosition;
printf("%p
", buffer);
printf("%c
", buffer[k]);
This is the original code, the program becomes unresponsive adfter i = *arrayposition...
int i, j;
Record *myRecord;
Resource *myResource;
unsigned char name[255];
unsigned char data[50];
unsigned int offset;
i = *arrayPosition;
while(buffer[i] != )
{
if((buffer[i] & 0xC000) == 0xC000)
{