<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yusuf Mücahit &#187; değişkenler</title>
	<atom:link href="http://yusufmucahit.com/tag/degiskenler/feed/" rel="self" type="application/rss+xml" />
	<link>http://yusufmucahit.com</link>
	<description>ODTÜ - Bilgisayar Mühendisliği</description>
	<lastBuildDate>Tue, 19 May 2015 19:52:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Introduction to Programming with C &#8211; Data Types and Variables</title>
		<link>http://yusufmucahit.com/en/c-ile-programlamaya-giris-veri-tipleri-ve-degiskenler/</link>
		<comments>http://yusufmucahit.com/en/c-ile-programlamaya-giris-veri-tipleri-ve-degiskenler/#comments</comments>
		<pubDate>Mon, 10 Feb 2014 18:23:24 +0000</pubDate>
		<dc:creator><![CDATA[Yusuf]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C programing]]></category>
		<category><![CDATA[C programlama]]></category>
		<category><![CDATA[C programlamaya giriş]]></category>
		<category><![CDATA[C programming]]></category>
		<category><![CDATA[Data types]]></category>
		<category><![CDATA[değişkenler]]></category>
		<category><![CDATA[introduction to programming]]></category>
		<category><![CDATA[Programlamaya giriş]]></category>
		<category><![CDATA[variables]]></category>
		<category><![CDATA[veri tipleri]]></category>

		<guid isPermaLink="false">http://yusufmucahit.com/?p=46</guid>
		<description><![CDATA[Variables are the places which stores the numbers, strings in the program. These belong to various data types, depends on what type of data we store. Basic data types in]]></description>
				<content:encoded><![CDATA[<p>Variables are the places which stores the numbers, strings in the program. These belong to various data types, depends on what type of data we store. Basic data types in C:</p>
<pre class="brush:other">char - 1 Byte 
int - Usually 4 Byte
float - Usually 4 Byte
double - Usually 8 Byte</pre>
<p>We get another versions of data types by putting modifiers in front of the data type names. These modifers are:</p>
<pre class="brush:other">short
long
unsigned</pre>
<p>You can easily learn which data type takes how many bytes in memory with this code:</p>
<pre class="brush:c">#include < stdio.h >
int main(){

    printf("%d byte", sizeof(int)); // put which data type you want to learn instead of int, such long int, short int, char, float...
    return 0;
}</pre>
<p>Because one byte consist of 8 bit and every bit takes only 1 or 0 value, one byte can take 2^8 different values. Hence, int data type , which takes 4 byte , takes 2^(8*4)-1 different positive integer values.</p>
<p>Now let&#8217;s look at which data type use for what.</p>
<p>char: Stores only one character. Stored data is not actually a character, it is a number matches to the characters in the <a title="Ascii table" href="http://www.asciitable.com/" target="_blank">ascii table</a>. Namely, it stores integers with the maximum size of 1 byte. It is enough to know that data type stores characters, for now.</p>
<p>int: Stores integers.</p>
<p>float: Stores floating point number with single precision.</p>
<p>double: Stores floating point number with double precision</p>
<p>Some modifers to put in front of these data types;</p>
<p>unsigned: It specifies no negative values. Therefore, 1 bit for sign join to number area in the memory. For example, char takes values between -128,127 and unsigned char takes values between 0,255.</p>
<p>long: It induces compiler to take more bytes than usual.</p>
<p>short: It induces compiler to take less bytes than usual.</p>
<p>After short explanation of data types, let&#8217;s come to variables. Variables are shortly the areas storing numbers inside which allow us to use (by writing or reading) them. Instead of calling these variables like the second 4byte in the ram ve call them by a name, for example &#8220;a&#8221;. This is not really difficult. Here is a code segment explained until these point.</p>
<pre class="brush:c">#include 

int main(){
    int a=3,b,c;
    long int d;
    unsigned long int e;
    float x,y,z;
    char k,l,m;
    unsigned char n;

    b=6;

    return 0;
}</pre>
<p>Variables are defined like.</p>
<pre class="brush:other">DATA_TYPE VARIABLE_NAME</pre>
<p>We can assign vales while defining such variables(look at the variable a), or you can just define one and then use it later in your program(look at the variable b).  We can read or write the data inside these variables easily. Here is a code segment which explains that.</p>
<pre class="brush:c">#include 

int main(){
    int a,b=3;
    float c;
    char d;
    scanf("%d %f %c", &#038;a, &#038;c, &#038;d);
    printf("a: %d, b: %d, c: %f, d: %c", a,b,c,d);  
    return 0;
}</pre>
<p>Another unknown thing; scanf. we can print something to the screen via printf function. scanf does the opposite takes data from the keyboard. For this program we expect 3 data from user to enter. It stores these data inside the a, c and d. &#8220;%d, %f, %c&#8221; are the format implying symbols to the compiler. It is used for both reading(scanf) and printing(printf) operations.</p>
<p>%d for integers.</p>
<p>%f for floating points.</p>
<p>%c for characters.</p>
]]></content:encoded>
			<wfw:commentRss>http://yusufmucahit.com/en/c-ile-programlamaya-giris-veri-tipleri-ve-degiskenler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
