C Variables

What are C Variables?

C Programming Language Stores Random Values in Memory Location. When we create a Variable using Variable Name, C Program Assign This Variable To Speific Memory Location. So, Variable is a place where we can store Values.

Variables can store multiple types of data, and this data can be defined by Data Types. We will study more about Data Types in Next Chapter.

Rules to create variable names in C Programming Language

  • Variable name must start with a letter. (1stName is not allowed variable name because it starts with number).
  • Variable names are case sensitive ( Rocky is not equal to rocky )
  • First 63 characters of variable names are significant (some compilers differentiate more characters when variable names are longer than 63 chars).
  • First 31 characters of function names are significant (some compilers differentiate more characters when function names are longer than 31 chars).
  • Variable names starting with Understore character is allowed, however usage of it is discouraged because system has implementation with variable names with Understores. ( e.g. _Sys_Date this name should be discouraged instead we can provide system_Date variable name.

Now we knew how we can put names we see some of the variable declarations.

Notes:

Comments in C Language is written as follows

// this is single line comment

/ *this is 
multi-line
comment */

Following are the Variable Name Declarations in C Language.

/* variable name declaration of type integer */
int no_of_Tyres; 

 /* interest is the variable name */
float interest;

 /* Compiler Throws An Error This name is not allowed */
char 1stLetter_of_paragraph;

/* this name is allowed   */
char first_letter_of_Paragraph;

 /* Discouraged as it starts with Underscore (it works but should not use). */
int _no_of_Tyres;

We learnt how we can name the variables, now we are going to learn about Data Types in the next chapter.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top