<?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 Mohamed Muzakkir on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Muzakkir on Medium]]></description>
        <link>https://medium.com/@alisabrymuzakkir?source=rss-996bc90821fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xUFUF3VWDLLrgVto</url>
            <title>Stories by Mohamed Muzakkir on Medium</title>
            <link>https://medium.com/@alisabrymuzakkir?source=rss-996bc90821fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:15:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alisabrymuzakkir/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[What is C++]]></title>
            <link>https://medium.com/@alisabrymuzakkir/data-types-of-c-f2c3e5ac0f9b?source=rss-996bc90821fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c3e5ac0f9b</guid>
            <dc:creator><![CDATA[Mohamed Muzakkir]]></dc:creator>
            <pubDate>Tue, 04 Oct 2022 18:18:41 GMT</pubDate>
            <atom:updated>2022-10-05T08:08:01.275Z</atom:updated>
            <content:encoded><![CDATA[<p>C++ is a general-purpose Object-Oriented Programming (OOP) language developed by Bjarne Stroustrup. C++ is a middle-level programming language and an extension of the C language. C++ runs on different operating platforms such as Windows, Macintosh OS, and different versions of UNIX.</p><h3>History of C++</h3><p>C++ programming language has an interesting history. In 1979, Bjarne Stroustrup used the Simula-67 programming language when working on a PhD Thesis project at Bell Laboratories. Simula-67 supported the object-oriented programming concepts and Stroustrup found it very easy and useful for software development. However, Simula was very slow when it came to practically implementing the programs.</p><p>Stroustrup then started to work on his new project “C with Classes”. He aimed to make use of the object-oriented programming concepts into C programming language (developed by Dennis Ritchie is 1972) without changing the C components. Later in 1983, the name C with Classes was changed to C++. The ++ operator is taken from C language which represents incrementing a variable. C++ is a superset of C programming language. This means that any “valid” C program is also a C++ program.</p><h3><strong>.Data Types of C++…………….</strong></h3><p>When writing a program, variables are used to store some information. It’s important to decide which variable stores what kind of information. Data type helps the compiler to understand what type of data can be stored into a particular variable.</p><p>For e.g., variable ‘a’ can hold only integer values, while ‘b’ can hold only character values. It is very important that you append the appropriate data type for the variable. Irrespective of defining a variable or not, the compiler automatically allocates memory space for the data type.</p><h3><strong>Datatypes</strong></h3><ol><li>Built in Data type</li><li>Derived Data type</li><li>User defined Data Type</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*LHhh2GIcqMkv_8s6RETFBw.png" /></figure><h3>Fundamental data types</h3><p>These data types are built-in or predefined data types and can be used directly by the user to declare variables. example: int, char, float, bool, etc. Primitive data types available in C++ are:</p><h3>Short Data type</h3><p>It is used for small integers, Its <strong>size</strong> is 2 bytes, Its <strong>range is -32768</strong> to <strong>32767.</strong></p><h3>Integer Data type</h3><p>Integer data type comprises of numbers without the decimal (fraction) part. Example: 34, 999, -5287, etc. Integer data types can be positive and/or negative values.</p><ul><li>Keyword used to define an integer data type : int</li><li>Number of bytes of memory space required : 4 bytes</li><li>Range of integer data type : -2147483648 to 2147483647</li></ul><h4>Example Program</h4><p>In this program, we will store 2 integer values in variables a and b, perform a sum operation of the two integer values and store the result in a third variable (result). We will print the value stored in the result variable.</p><pre>#include &lt;iostream&gt;<br>using namespace std;</pre><pre>int main ()<br>{<br> int a, b;<br> int result;<br> a = 3;<br> b = 4;<br> result = a + b;<br> cout &lt;&lt; result;<br> return 0;<br>}</pre><h3>Character Data type</h3><p>Character data type has the capability to store any single character from the ASCII character set. It can be an alphabet, a digit, space or punctuation. The characters are internally stored as integers between the range of -128 to 127. Therefore, the character data type can also be treated as an integer data type.</p><ul><li>Keyword used to define an integer data type : char</li><li>Number of bytes of memory space required : 1 byte (only one character at a time)</li></ul><h4>Example Program</h4><p>In this program, we will ask the user to enter a character. We will store the character in a variable (a) defined as a character data type. We will then print the value stored in the character data type variable.</p><pre>#include&lt;iostream&gt;<br>using namespace std;</pre><pre>int main ()<br>{<br> char a;<br> cout&lt;&lt; &quot;Enter a character: &quot;;<br> cin &gt;:&gt; a;<br> cout &lt;&lt; &quot;The character you entered is: &quot;&lt;&lt; a;<br> return 0;<br>}</pre><h3>Void Data type</h3><p>Void data type can be used to specify an empty parameter list for a function as well as a return type for the function. When void is specified, no memory will be allocated. When it is used to specify an empty parameter list, it means that the function will not take any arguments. When used as a return type for the function, the function will not return any value.</p><h3>Float Date type</h3><p>Float data type refers to any integer having a decimal part. Example: 15.6744, 763.09124, etc. are referred to as floating point numbers. If you write the number 25, it is an integer. While 25.0 is a floating-point number. You must use the floating-point data type when you make some calculations such as average, percentage and so on.</p><p>. Keyword used to define an integer data type : float</p><p>. Number of bytes of memory space required : 4 bytes</p><h4>Example Program</h4><p>In this program, we will perform a mathematical calculation to convert miles to kilometers. We will collect the miles as user input and store it in a variable. We will multiply the user input with a value of 1.60934 and store the result in another variable (km). Finally, we will print the value of the (km) variable to the user.</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br>int main ()<br>{<br>float m;<br>float km;<br>cout &lt;&lt; &quot;Enter the distance in miles:&quot;;<br>cin &gt;&gt; m;<br>km = m * 1.60934;<br>cout &lt;&lt; &quot;The distance in kilometer is: &quot;&lt;&lt; km;<br>}</pre><h3>Double Data type</h3><p>Double data type can be used to handle floating point values. But the difference from the float data type is that double data type occupies double the memory size. Double data type can store more numbers after the decimal point (~15 digits).</p><p>. Keyword used to define an integer data type : double</p><p>. Number of bytes of memory space required : 8 bytes</p><h4>Example Program</h4><pre>#include &lt;iostream&gt;<br>using namespace std;<br>int main ()<br>{<br>double a = 5426904022.9684902434392323;<br>cout &lt;&lt; &quot;Double Floating Point:&quot;&lt;&lt; a;<br>}</pre><h3>bool (boolean)</h3><p>A boolean data type is declared with the bool keyword and can only take the values true or false. This variable is use for false and true statement. if false than I would contain zero and if true than it one will be store in it. Its is <strong>size</strong> is 1 byte and its range is 0 to 1. When the value is returned, true = 1 and false = 0.</p><pre>#include &lt;iostream&gt;<br>using namespace std;int main() {<br>  bool isCodingFun = true;<br>  bool isFishTasty = false;<br>  cout &lt;&lt; isCodingFun &lt;&lt; &quot;\n&quot;;<br>  cout &lt;&lt; isFishTasty;<br>  return 0;<br>}</pre><h3>User defined data type</h3><h3>String</h3><p>The<strong> string</strong> type is used to store a sequence of characters (text). This is not a built-in type, but it behaves like one in its most basic usage. String values must be surrounded by double quotes:</p><p>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br>using namespace std;</p><p>int main() {<br> string greeting = “Hello”;<br> cout &lt;&lt; greeting;<br> return 0;<br>}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c3e5ac0f9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>