我使用Linux进行编译。在 struct ip
(对于 IPv4)中,当我尝试将值指定为 ip1.ip_dst = 0xffffffff;
时,出现以下错误:
error: incompatible types when assigning to type ‘struct in_addr’ from type 'unsigned int' ip.ip_dst = 0xffffffff;`
我应该为具有 struct in_addr
数据类型的变量赋予什么值?我该如何解决这个错误?
最佳答案
in_addr
是一个具有单个 unsigned long
成员的结构:
struct in_addr ip_dest;
ip_dest.s_addr = 0xffffffffL;
关于c - 从类型 ‘struct in_addr’ 分配给类型 'unsigned int' 时不兼容的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34367459/