Sorry for the obscure title.

I assume this is casting (i hope)

Code:
struct ip_header *ip
 
ip = (struct ip_header *) (packet + ethernetHeader)
Assuming i am correct, this next bit of code threw me.

Funtion pcap_next retruns a u_char pointer to the packet it captures.

I thought the code would be:

Code:
u_char *packet
packet = pcap_next(exp1, exp2)
However in the book i have its written:

Code:
u_char packet*
packet = (u_char *) pcap_next(exp1, exp2)
Is this casting?? Was my original understanding of casting incorrect, it not a subject im very familiar about.

Just having trouble understanding why the code in the book (which is correct) has the (u_char) before pcap_next.

Many thanks for any help!