E
Eric J.Hu
Hi,
I have following code, want do pointer convert. It always complain:
vcnvt.c: In function `main':
vcnvt.c:20: warning: dereferencing `void *' pointer
vcnvt.c:20: request for member `key' in something not a structure or union
---------------------------
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
u_long key;
u_long transCmdAdd;
u_long transCmdMod;
u_long transCmdSub;
u_long transCount;
} counting_bin_t, *counting_bin_p;
int main()
{
void * vbPtr;
counting_bin_t cBin[9];
cBin[0].key = 9;
vbPtr = cBin;
printf("key is %d\n", vbPtr->key);
}
Thanks,
Eric
I have following code, want do pointer convert. It always complain:
vcnvt.c: In function `main':
vcnvt.c:20: warning: dereferencing `void *' pointer
vcnvt.c:20: request for member `key' in something not a structure or union
---------------------------
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
u_long key;
u_long transCmdAdd;
u_long transCmdMod;
u_long transCmdSub;
u_long transCount;
} counting_bin_t, *counting_bin_p;
int main()
{
void * vbPtr;
counting_bin_t cBin[9];
cBin[0].key = 9;
vbPtr = cBin;
printf("key is %d\n", vbPtr->key);
}
Thanks,
Eric