# Variables in c language

Variables-: A variable is  data name that may be used to store a data valueonly constant that remain unchanged during the execution of a program a variable may take different values at different times during execution.We used several variable in our program . variable store the value of money at the end of each year A variable name can be chosen by the programmer in a meaningful way so as to replace function or nature in the program some example of some names are here height, Total, weight, amount etc.

In other words we can say that the variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable’s memory. the range of values that can be stored within that memory  and the set of operations that can be applied to the variable.

#### Rules of variable declaration-:

Variable name may consist of letter, digits and the underscore character(_) subject to the following conditions

1 they must begin with a letter some system permit underscore as the first character .

2.ANSI standard recognizes a length of 31 characters however length should not be normally more than 8 characters since only the first 8 characters are treated as significant by many compilers

3. uppercase and lowercase are significant that is the variable total is not the same as total equity TOTAL .

4. it should not be a keyword.

5 white space is not allowed some

Valid variable are here example are here Ram, Shyam, Mohan, Sohan Delhi Rajasthan

Types of variable name -: Like any other programming language C support four type variable name. These are the

• Int -: All the number of variable are declare in this integer value. The integer value are the 0 to 9. In this variable types all number are permitted.
• char -: It means all the character value are store in this variable type.as like if we write a name we can define in this type variable.
• float -: in this type variable store the single-precision floating point value.
• void-: in this type variable Represents the absence of type.
• double-: This type variable -precision floating point value.

### How to declare a variable in c programming language

There are some rules for declare a variable in c programming language. Follow these rules

A variable declaration is very useful when we are using multiple files . We can  define our variable in one of the files which will be available at the time of linking of the program. we shall use the keyword netnic to declare a variable at any place. we can declare a variable multiple times in our C program, it can be defined only once in a file, a function, or a block of code..For syntax of variable declare

`variable_type variable_name;`

For example if we are giving the integer value then we declare the variable name

`Int x;       // x is the integer  variable name int y;       // y is the integer variable name int netnic;  // netnic is the integer variable name int vikram;  //vikram is the integer variable name int ramla;   // ramla is the integer variable name `

character variable name and declare type.

`char a;  //a is the character valuechar b;    //b is the character valuechar roshan;  //roshan is the character value`

Like we declare float and double

`float c ; double d;`

A  complete example of declare a variable-:

`#include <stdio.h>#include <conio.h>//  variable declaration  in c programming int a;int b; // we can write here as like int a,b,c;int c;float f;int main(){ /* variable definition */  for commenting   int a,b;  int c;  float f;/* actual initialization */  for commenting line a=20; b=40; c=a+b;  // for adding two variable number printf(" The total number of c :%d \n",c);f=46.33;printf(" The value of f : %F \n",f);getch();}`

Output of this program -:

` The total number of c :60  The value of f : 46.33`
{"ft_lang_label":"__label__en","ft_lang_prob":0.81105393,"math_prob":0.97652197,"size":3839,"snap":"2020-45-2020-50","text_gpt3_token_len":854,"char_repetition_ratio":0.18591917,"word_repetition_ratio":0.027737226,"special_character_ratio":0.23000781,"punctuation_ratio":0.11443433,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9774179,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-24T20:52:12Z\",\"WARC-Record-ID\":\"<urn:uuid:11299d99-2cb9-4b9b-9061-ab74200c89a5>\",\"Content-Length\":\"40348\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:48cf28fb-0d5a-42e2-adc4-ad6c7eeaab90>\",\"WARC-Concurrent-To\":\"<urn:uuid:f97f66fc-d49a-47f2-880f-88c66bb478a1>\",\"WARC-IP-Address\":\"182.50.151.51\",\"WARC-Target-URI\":\"http://www.netnic.org/variables-in-c-language/\",\"WARC-Payload-Digest\":\"sha1:4IOBLIPET6Y4BPSLQLAQMMEDP6AU46WK\",\"WARC-Block-Digest\":\"sha1:QCWPSHNK7OFKMPZKKIMAMGSIQEUFMAWC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141177566.10_warc_CC-MAIN-20201124195123-20201124225123-00305.warc.gz\"}"}