在C代码中表示MAC地址 [英] representation of MAC address in C code
本文介绍了在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地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文