Pointers question

str is known by the compiler as an array of 44 constant char (if i counted well with the invisible trailing null char)

When str is used directly in the memset call, the variable is said to decay to a pointer to the first element of the array: basically a conversion takes place and the resulting type is a const char *. If you add 1 to that pointer you jump to the next char.

When str is used with the address of (&) operator, there is no decay. The & tells the compiler to take the address of the array and thus the type of &str is a pointer to the array as a whole. (If you were to add 1 to this pointer you would jump in memory by the size of the array).

So basically the type is different, but because the first element of the array is at the same position in memory as the start of the whole array, these two pointers have exactly the same value.

This is this value that is passed to the memset function. As the parameter is declared as void* and a pointer can always be cast to a void* (a generic pointer type pointing at nothing special, basically a memory address with no information about what you are pointing to) in the code of the function the value just look the same, the type has been transformed and all info has been lost and memset can do its job (because it does not care what you are pointing at).

Developers use void* instead of uint8_t* (byte pointer) because you won’t get a warning if you pass the address of a structure or a char*, they are all compatible types with void*

So long story short it does not matter what notation you use, just remember you loose information during the decaying process.