A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C_Tutorial%2FLanguage%2FVariable_Declaration</id>
		<title>C Tutorial/Language/Variable Declaration - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C_Tutorial%2FLanguage%2FVariable_Declaration"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/Language/Variable_Declaration&amp;action=history"/>
		<updated>2026-04-17T17:48:57Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C_Tutorial/Language/Variable_Declaration&amp;diff=3830&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/Language/Variable_Declaration&amp;diff=3830&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C_Tutorial/Language/Variable_Declaration&amp;diff=3831&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C_Tutorial/Language/Variable_Declaration&amp;diff=3831&amp;oldid=prev"/>
				<updated>2010-05-25T10:32:42Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Define three variables and use assignment operator to assign value==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;int main() &lt;br /&gt;
    {  &lt;br /&gt;
        int term;       /* term used in two expressions */ &lt;br /&gt;
        int term_2;     /* twice term */   &lt;br /&gt;
        int term_3;     /* three times term */ &lt;br /&gt;
        term = 3 * 5;  &lt;br /&gt;
        term_2 = 2 * term; &lt;br /&gt;
        term_3 = 3 * term; &lt;br /&gt;
        return (0);&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How to declare a variable==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A variable declaration serves three purposes:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;It defines the name of the variable.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;It defines the type of the variable (integer, real, character, etc.).&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;It gives the programmer a description of the variable.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;int answer;     /* the result of our expression */&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;The keyword int tells C that this variable contains an integer value.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The variable name is answer.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The semicolon (;) marks the end of the statement.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The comment is used to define this variable for the programmer.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Initialize int value in declaration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  int number0 = 10, number1 = 40, number2 = 50, number3 = 80, number4 = 10;&lt;br /&gt;
  int number5 = 20, number6 = 30, number7 = 60, number8 = 70, number9 = 110;&lt;br /&gt;
  int sum = number0 + number1+ number2 + number3 + number4+&lt;br /&gt;
        number5 + number6 + number7 + number8 + number9;&lt;br /&gt;
  float average = (float)sum/10.0f;&lt;br /&gt;
  printf(&amp;quot;\nAverage of the ten numbers entered is: %f\n&amp;quot;, average);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Average of the ten numbers entered is: 48.000000&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Meaningful variable name==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;int p,q,r;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use printf to output variable==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt; &lt;br /&gt;
    &lt;br /&gt;
    int main() &lt;br /&gt;
    {  &lt;br /&gt;
        int term;       /* term used in two expressions */ &lt;br /&gt;
        term = 3 * 5;  &lt;br /&gt;
        printf(&amp;quot;Twice %d is %d\n&amp;quot;, term, 2*term);  &lt;br /&gt;
        printf(&amp;quot;Three times %d is %d\n&amp;quot;, term, 3*term);&lt;br /&gt;
        return (0);&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;Twice 15 is 30&lt;br /&gt;
Three times 15 is 45&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The number of %d conversions should match the number of expressions.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using a variable to store value==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  int salary;            &lt;br /&gt;
  salary = 10000;        &lt;br /&gt;
  printf(&amp;quot;My salary is %d.&amp;quot;, salary);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;pre class=codeResult&amp;gt;My salary is 10000.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;You can store values in variables.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Each variable is identified by a variable name.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Each variable has a variable type.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Variable names start with a letter or underscore (_), followed by any number of letters, digits, or underscores.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Uppercase is different from lowercase, so the names sam, Sam, and SAM specify three different variables.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The variables are defined at the begining of the block.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The following is an example of some variable names:&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;average            /* average of all grades */ &lt;br /&gt;
    pi                 /* pi to 6 decimal places */    &lt;br /&gt;
    number_of_students /* number students in this class */&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>