gpt4 book ai didi

c - 从类型 ‘struct in_addr’ 分配给类型 'unsigned int' 时类型不兼容

转载 作者:太空狗 更新时间:2023-10-29 12:01:29 24 4
gpt4 key购买 nike

我正在使用 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/

24 4 0
文章推荐: css - Bootstrap - 列表组项中的按钮
文章推荐: layout - 使用
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com