Rules to Declare Variable in C

Google Advertisements

Prev Tutorial Next Tutorial

Variable Declaration Rules in C

To Declare any variable in C language you need to follow rules and regulation of C Language, which is given below;

  • Every variable name should start with alphabets or underscore (_).
  • No spaces are allowed in variable declaration.
  • Except underscore (_) no other special symbol are allowed in the middle of the variable declaration (not allowed -> roll-no, allowed -> roll_no).
  • Maximum length of variable is 8 characters depend on compiler and operation system.
  • Every variable name always should exist in the left hand side of assignment operator (invalid -> 10=a; valid -> a=10;).
  • No keyword should access variable name (int for <- invalid because for is keyword).

Note: In a c program variable name always can be used to identify the input or output data.

Variable declarations

This is the process of allocating sufficient memory space for the data in term of variable.

Syntax

Datatype  variable_name;
int  a;
variable declaration

If no input values are assigned by the user than system will gives a default value called garbage value.

Garbage value

Garbage value can be any value given by system and that is no way related to correct programs. This is a disadvantage of C programming language and in C programming it can overcome using variable initialization.


Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements


Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: hitesh.xc@gmail.com or 8076671483 Try this Keyword C++ Programs