Not necessarily a question as much as a helpful tip for naming variables in large programs. When you gave enough variables you start losing track, it can be helpful to name them with the variable type first. i.e. int int_salary = 40000; string str_salary_type = "Hourly"; char char_salary_id = 'H'; | SoloLearn: Learn to code for FREE!

+3

Not necessarily a question as much as a helpful tip for naming variables in large programs. When you gave enough variables you start losing track, it can be helpful to name them with the variable type first. i.e. int int_salary = 40000; string str_salary_type = "Hourly"; char char_salary_id = 'H';

8/20/2016 10:11:57 PM

Clayton Summers

1 Answer

New Answer

+4

Hi Clayton, this is usually part of a style guide. There are many and they differ quite a bit. Oftentimes style guides are subject to opinion (as to what we are being used to see) rather than fact. What you suggest is a long form of so-called "Hungarian Notation". It is / was quite common in the late 90ies and early 2000s. Nevertheless, today there has been a shift to naming styles that care more for the actual meaning of the variable or function, e.g. see Google style guide: https://google.github.io/styleguide/cppguide.html