Yes you are able to conclude that structure types are not able to cast directly. So you must need to type cast it as shown in first line written by you.
conversion to non-scalar type
Question
This line will compile fine:
memcpy(&rp.iplow, &((struct sockaddr_in*) &dstl)->sin_addr, 4);
whereas what I originally coined it as:
memcpy(&rp.iplow, &((struct sockaddr_in) dstl).sin_addr, 4);
will say error: conversion to non-scalar type requested
Shall I conclude that one cannot use struct types for casting whatsoever?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow