void * pointer convert problem.
- From: "Eric J.Hu" <ehu@xxxxxxxxxx>
- Date: Fri, 30 Dec 2005 12:56:25 -0500
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
.
- Follow-Ups:
- Re: void * pointer convert problem.
- From: abdur_rab7@xxxxxxxxxxx
- Re: void * pointer convert problem.
- From: Keith Thompson
- Re: void * pointer convert problem.
- From: Flash Gordon
- Re: void * pointer convert problem.
- From: nelu
- Re: void * pointer convert problem.
- From: Christopher Benson-Manica
- Re: void * pointer convert problem.
- Prev by Date: Re: String reversing problem
- Next by Date: Re: Signal handler for SIGSEGV.
- Previous by thread: How to stop reading a file?
- Next by thread: Re: void * pointer convert problem.
- Index(es):
Relevant Pages
|