What does `m_` variable prefix mean?

kravemir picture kravemir · Oct 21, 2012 · Viewed 127.8k times · Source

I often see m_ prefix used for variables (m_World,m_Sprites,...) in tutorials, examples and other code mainly related to game development.

Why do people add prefix m_ to variables?

Answer

House picture House · Oct 21, 2012

This is typical programming practice for defining variables that are member variables. So when you're using them later, you don't need to see where they're defined to know their scope. This is also great if you already know the scope and you're using something like intelliSense, you can start with m_ and a list of all your member variables are shown. Part of Hungarian notation, see the part about scope in the examples here.