Typo in the final slide

Hey I was going to save the last slide image for later reflection but I noticed what might be a typo, if it’s not then I’m confused about the syntax of declaring a reference.

should the & be attached to the end of the variable type? This is how we did it in the lesson for the float& example, but in the last slide its attached to the variable instead, thanks.

It doesn’t matter at all to the compiler.

float& DamageRef
float & DamageRef
float &DamageRef

all three mean the exact same thing. Most C++ developers would put it next to the type, however.

ah good to know, thanks for the reply.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms