本文介绍了在C代码中表示MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
struct mac_addr { unsigned char bytes [ 6]; }
为什么在结构中放置一个数组,为什么不只有一个数组?这有什么好处?
谢谢。
解决方案不要在C中分配一个数组,但可以分配一个结构体。
I often see such representation of MAC address in C code:
struct mac_addr { unsigned char bytes[6]; }Why necessary put an array in a structure, why not just have an array? What benefit does this provide?
Thanks.
解决方案You can't assign an array in C. But you can assign a struct.
更多推荐
在C代码中表示MAC地址
发布评论