C 代码中 MAC 地址的表示 [英] representation of MAC address in C code

查看:15
本文介绍了C 代码中 MAC 地址的表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在 C 代码中看到这样的 MAC 地址表示:

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?

谢谢.

推荐答案

你不能在 C 中分配一个数组,但是你可以分配一个结构体.

You can't assign an array in C. But you can assign a struct.

这篇关于C 代码中 MAC 地址的表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆