what does this line do? I don't understand its syntax, the buffer is the name of a dynamic variable. buffer type char
(unsigned int*)buffer
what does this line do? I don't understand its syntax, the buffer is the name of a dynamic variable. buffer type char
(unsigned int*)buffer
It's a C-style cast to the type unsigned int *
.
unsigned int *
This is a pointer to an unsigned int in C. Casting is used when you have a variable of a different type and you want it to be a different type. A pointer is a variable that holds the address of a variable. So, casting buffer as an unsigned int *
tells the computer to interpret buffer (a pointer of 1 byte) as a pointer that points to memory of the size unsigned int
(4 bytes).