uint8_t* 与 uint8_t 的区别 [英] Difference between uint8_t* vs uint8_t

查看:202
本文介绍了uint8_t* 与 uint8_t 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两种类型有什么区别/用途?我对指针有一个基本的了解,但我无法理解这一点.

What is the difference/use for these 2 types? I have a basic understanding regarding pointers but I just can't wrap my head around this.

uint8_t* address_at_eeprom_location = (uint8_t*)10;

在 Arduino 示例中发现的这一行让我觉得很愚蠢.:)

This line found in an Arduino example makes me feel so dumb. :)

所以基本上这是一个双指针?

So basically this is a double pointer?

推荐答案

uint_t 是无符号整数,这是直接存储在内存中的数据.uint_t * 是指向存储数字的内存的指针.(uint_t*) 是将 10 - (字面量,它被转换为内存中的数字,因此数字十的二进制表示)转换为指针类型.这将创建用于存储 10 的存储器,然后将使用其地址并将其存储在 address_at_eeprom_location 变量中.

The uint_t is the unsigned integer, this is the data stored directly in the memory. The uint_t * is the pointer to the memory in which the number is stored. The (uint_t*) is cast of the 10 - (literal which is translated to a number in the memory so the binary representation of the number ten) to the pointer type. This will create the storage to store the 10, and than will use its address and store it in the address_at_eeprom_location variable.

这篇关于uint8_t* 与 uint8_t 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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