I have the following line of code that I have to convert from C++ to C:
const MyStruct &r = pMyContext->buffer [counter];
first of all, I don’t really understand what’s going on here. I presume this line creates a new instance of the structure (r) and is filling its address with the contents of the buffer?
I’m developing a device driver, the C compiler returns:
error C2143: syntax error : missing ';' before '&'
Any Ideas?
EDIT:
In My header i have:
#define MAX_BUFFER_SIZE 40U
typedef struct {
int a;
int b;
}buffer_entry_t;
typedef struct _DEVICE_CONTEXT
{
buffer_entry_t m_tBuffer[MAX_BUFFER_SIZE];
}
DEVICE_CONTEXT, *PDEVICE_CONTEXT;
Thanks