- Variable names in C, generically called identifiers, use the underscore character to mash together words to make useful names. This is called
snake case.
For example,
double city_sales_tax = 0.08;
int days_in_year_2018 = 365;
char superman_letter = ‘s’;
char *mothers_maden_name = “Smith”;
Another way to do this is to omit the underscore but to capitalize the first letter of each word in the identifier, except for the first word. This is called
camel case. For example,
double citySalesTax = 0.08;
int daysInYear2018 = 365;
char supermanLetter = ‘s’;
char *mothers_maden_name = “Smith”;
These are called naming conventions.
In general, you can use either in your programs, BUT you need to constantly use one or the other in your code, and avoid mixing the 2 in the same program.
Which one makes the most sense to you, and why?