DEV Community

Cover image for Variables in C Programming

Variables in C Programming

Sujith V S on December 07, 2023

A variable is a name given to a memory location inside our computer where we can store data. Variable declaration int age; In C programming, a var...
Collapse
 
pauljlucas profile image
Paul J. Lucas • Edited

Dennis Ritchie (the creator of C) disagrees with the use of CamelCase. It is not the common naming convention in C.

You neglected to mention that:

  • _ counts as a letter.
  • External names that begin with _ are reserved for use by the implementation.
  • Any names that begin with a _ followed by either a capital letter or _ are also reserved for use by the implementation.

The full list is here.

Your example of declaring two variables in the same line makes it seem like both are initialized to 25 when that is not true.

Collapse
 
sujithvsuresh profile image
Sujith V S • Edited

Thanks for your valuable comment. But what is the problem with declaring two variables in a single line. I have done that in many occasions for declaring and initialising same type of values.

Collapse
 
pauljlucas profile image
Paul J. Lucas

Strictly speaking, nothing. But if you read what I actually said, your example:

int variable1, variable2 = 25;
Enter fullscreen mode Exit fullscreen mode

looks to someone not familiar with C like that might assign 25 to variable2 and also to variable1 when in reality variable1 is uninitialized.

Thread Thread
 
sujithvsuresh profile image
Sujith V S

Yeah okay.