Pointers To Structs

There’s just one little wrinkle you need to know about structs when it comes to pointers. If you have a pointer to a struct and you want to get access to one of its fields then there’s a shorthand: ptrToStruct->fieldName is the same as *(ptrToStruct).fieldName

Leave a Reply

Your email address will not be published. Required fields are marked *