<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ishara Ifthikar on Medium]]></title>
        <description><![CDATA[Stories by Ishara Ifthikar on Medium]]></description>
        <link>https://medium.com/@ifthikarishara?source=rss-f73dc5519a6b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LPVqEEhifmjTnTnU34n9CQ.jpeg</url>
            <title>Stories by Ishara Ifthikar on Medium</title>
            <link>https://medium.com/@ifthikarishara?source=rss-f73dc5519a6b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:44:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ifthikarishara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[C++ Data Types]]></title>
            <link>https://medium.com/@ifthikarishara/c-data-types-38b69a465eda?source=rss-f73dc5519a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/38b69a465eda</guid>
            <dc:creator><![CDATA[Ishara Ifthikar]]></dc:creator>
            <pubDate>Tue, 04 Oct 2022 10:13:17 GMT</pubDate>
            <atom:updated>2022-10-06T06:44:12.219Z</atom:updated>
            <content:encoded><![CDATA[<h4>Study about C++ data types</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*jiSBFZA2eF7amrPuCZts0g.gif" /></figure><h4><strong>What is C++ language ?</strong></h4><p>C++ is a general-purpose programming and coding language. C++ is used in developing browsers, operating systems, and applications, as well as in-game programming, software engineering, data structures, etc.</p><h4>What is data types ?</h4><p>Data types are means to identify the type of data and associated operations of handling it in programming.</p><h4>There are mainly 2 types of data types in C++ language.</h4><ol><li>Fundamental Data Type</li><li>User Defined Data Type</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*XZ2xO3YhL_vYspFe0CGz2w.png" /><figcaption>C++ DATA TYPES</figcaption></figure><h4>Fundamental data types (Primitive data type)</h4><p>Fundamental data type is a very basic data type. It is also known as primitive data type. Fundamental data types are the data types <strong>which are predefined</strong> in the language and can be directly used to declare a variable in C++. It is already exists in the language.</p><p>Those fundamental data types are: short, int, float, double, bool, char</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3D1iD2PghoBtM9-EvAjEzg.png" /><figcaption>Size of Fundamental data types of C++</figcaption></figure><p>According to the above table we can see the fundamental data types of C++ language and the memory required for storing.</p><p>Now we are going see fundamental data types of c++ programming language one by one.</p><h3>short</h3><ul><li>The short data type is used for small integers.</li><li>It has a minimum value of -32,728 and a maximum value of 32,767.</li><li>In situation where the memory saving actually matters we can use short data type.</li><li>Memory required for short data type is 2 bytes.</li></ul><h4>example coding for data type : short</h4><p><em>#include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>short a ; //declaration of variable</em></p><p><em>a = 5; //initialization of variable</em></p><p><em>cout&lt;&lt; age; //print age</em></p><p><em>return 0;</em></p><p><strong>}</strong></p><h3>int (integer)</h3><ul><li>The key word used for integer is<strong> int .</strong></li><li>It has a minimum value of 2,147,483,648 and a maximum value of 2,147,483,647.</li><li>The integer data type is whole number. They have no fractional parts. It can have positive or negative values.</li><li>If we assign a number <strong>3.41</strong> for an <strong>int</strong> variable the variable value which the computer store is <strong>3</strong></li><li>Memory required for integer data type is 4 bytes.</li></ul><h4><strong>example coding for data type : int</strong></h4><p><em>#include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>int a; //declaration of variable</em></p><p><em>a= 5; //initialization of variable</em></p><p><em>cout&lt;&lt; a;</em> <em>//print a</em></p><p><em>return 0;</em></p><p>}</p><h3>float (floating point )</h3><ul><li>The keyword used for floating point is <strong>float</strong>.</li><li>float data type is used for a real number with 7 digits of precision.</li><li>A number having fractional part is a floating point numbers. Example : 3.14159</li><li>The <strong>decimal point</strong> signals that it is a floating-point number not an integer.</li><li>The number <strong>12</strong> is an <strong>integer</strong> but <strong>12.0</strong> is a <strong>floating point number</strong>.</li><li>Memory required for float data type is 4 bytes.</li></ul><h4><strong>example coding for data type : float</strong></h4><p><em>#include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>float pi ; //declaration of variable</em></p><p><em>pi = 3.14; //initialization of variable</em></p><p><em>cout&lt;&lt; pi; //display the out put of pi</em></p><p><em>return 0;</em></p><p><em>}</em></p><h3>double (double floating point)</h3><ul><li>The keyword used for double floating point is <strong>double</strong>.</li><li>double data type is used for a real number with 15 digits of precision.</li><li>The data type double also used for floating point numbers.</li><li>It (double data type) occupies twice as much memory as type float, and stores floating-point numbers with much longer range and precision.</li><li>If we assign a number <strong>3</strong> for an <strong>double</strong> variable the variable value which the computer store is <strong>3.00</strong></li><li>Memory required for double data type is 8 bytes.</li></ul><h4>example coding for data type : double</h4><p><strong><em>#</em></strong><em>include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>double s ; // declaration of variable</em></p><p><em>s = 564.365 ; //initialization of variable</em></p><p><em>cout&lt;&lt; s; //display the out put of s</em></p><p><em>return 0;</em></p><p><em>}</em></p><h3>bool (boolean)</h3><ul><li>The keyword used for boolean is <strong>bool</strong>.</li><li>It is used to store two values only true or false.</li><li>Memory required for bool data type is 1 byte.</li></ul><h4>example coding for data type : bool</h4><p><em>#include &lt;iostream&gt; // including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>bool b ; //declaration of variable</em></p><p><em>b = true ; //initialization of variable</em></p><p><em>cout&lt;&lt; b; //display the out put of b</em></p><p><em>return 0;</em></p><p><em>}</em></p><h3>char (character)</h3><ul><li>The key word used for character is <strong>char</strong>.</li><li>This data type used to store one characters like f/m , y/n .</li><li>Memory required for char data type is 1 byte.</li></ul><h4>example coding for data type : char</h4><p><em>#include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>char n ; //declaration of variable</em></p><p><em>n = ‘y’ ; //initialization of variable</em></p><p><em>cout&lt;&lt; n; //display the out put of y</em></p><p><em>return 0;</em></p><p><em>}</em></p><h4>User defined data types ( Non primitive data type)</h4><p>User defined data types are not defined in language. These data types are <strong>derived from the fundamental data types</strong>. These data types are not exists in language. User can defined a data type through existing predefined data types (fundamental).</p><p>string is a user defined data type of C++ .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ZEwVUn-sEocNs3W2yAPcg.png" /><figcaption>Size of user defined data type of C++</figcaption></figure><p>According to the above table it shows what a string data type stores and its size.</p><h3>string</h3><ul><li>Fundamental data type for the string is char.</li><li>The string type is used to store a sequence of characters (text).</li><li>String values must be surrounded by double quotes.</li><li>Examples: “hello” , “ November 22 nd is my birthday”</li><li>Memory required for string data type is 1 byte per character.</li></ul><h4>example coding for data type : string</h4><p><em>#include &lt;iostream&gt; //including library</em></p><p><em>using namespace std; //using namespace</em></p><p><em>int main() //main function</em></p><p><em>{</em></p><p><em>string a ; //declaration of variable</em></p><p><em>a = “hello this is my assignment” ; //initialization of variable</em></p><p><em>cout&lt;&lt; a; //display the out put of a</em></p><p><em>return 0;</em></p><p><em>}</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38b69a465eda" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>