I want to print addresses of void pointer
u32 j;
for (j = 0; j < sizeof(struct queue_header); j += 4)
{
printf("0x%x ",(u32 *)((u32 *)q->q_hdr + j)); //q_hdr is a void pointer
}
but that type conversion is giving error:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
can you please tell me how can I print the address.
j += 4is wrong: if you cast tou32 *, you are already counting in terms ofu32s, soj++would be right. - glglgl(u32*)casting is sufficient in this case. - barak manos%xforint(or smaller) variables,%lxforlong intvariables,%llxforlong long intvariables, and%pforType*(pointer) variables. - barak manos