My source file has a function, which I invoke in the process of de-serializing a struct passed over a C socket (this is the client source):
MY_STRUCT_TYPE myStructVar;
unsigned char * deserialize_chararr(unsigned char *buffer, unsigned char** value)
{
    unsigned char val[256];
    int i;
    for(i = 0; buffer[i]; i++) {
        val[i] = buffer[i];
    }
    val[i++] = '\0';
    printf("\n chararr: %s :", val);
    *value = malloc(i * sizeof **value);
    for(i = 0; buffer[i]; i++) {
        (*value)[i] = buffer[i];
        printf("%c", (*value)[i]);
    }
    (*value)[i++] = '\0';
    /* buffer contains a serialized struct read over a socket using recv. 
so this call returns the buffer pointer that get's passed to the next deserialize_<type> invocation a la https://stackoverflow.com/a/1577174/434145
That's why the first string extraction followed by an attempt to set it in the struct as part of unpacking. */
    return buffer + i;
}
that I'm calling as
buffer = deserialize_chararr(buffer, &myStructVar->szrecordid);
where
typedef struct _MY_STRUCT_TYPE {
    unsigned char   szrecordid[28];
}
The server sends the data alright and it even parses correctly in the above function, but I can't seem to be able to set it in the String variable of my struct. I changed my function to use char ** param after seeing this, but still get rubbish when I print
printf("\n Payload:"  "\n szrecordid: %s ", myStructVar.szrecordid);
In short, I pass a pointer to a string (&myStructVar->szrecordid), use malloc and assign my pointee character by charcter (this latter part I got from the link). Both before and after I changed the code from using a char * to using a char ** I was getting the same error and a compiler warning:
client.c:159: warning: passing arg 2 of `deserialize_chararr' from incompatible pointer type
So what am I doing wrong?
 
     
     
     
    