cancel
Showing results for 
Search instead for 
Did you mean: 

why Pointer is always (uint8_t *)?

smhhadima
Associate II
Posted on September 12, 2015 at 12:45

why Pointer is always (uint8_t *)?

does it mean the pointer will never exceed 255?
3 REPLIES 3
Posted on September 12, 2015 at 14:34

It's a pointer to 8-bit values, the pointer itself is 32-bit wide and can address 4GB 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
smhhadima
Associate II
Posted on September 12, 2015 at 21:15

I am using STM32F407

When I pass a pointer of a string to a function, should I used ( uint32_t * ) instead of (uint8_t*)?

Because all the examples that I see uses (uint8_t*)

Posted on September 13, 2015 at 01:19

The concept of pointers transcends the use of an STM32, you might want to review the K&R chapter on pointers, or that of your primary text.

It's pointing to a series of bytes/characters, these are 8-bit in size. If you used (uint32_t *) you'd be pointing at 32-bit words.

sizeof(uint8_t) = 1  // The thing it's pointing AT

sizeof(uint8_t *) = 4 // The pointer to it, an ADDRESS

sizeof(uint32_t) = 4 // The thing it's pointing AT

sizeof(uint32_t *) = 4 // The pointer to it, an ADDRESS

All WHAT examples?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..