{"id":1003,"date":"2021-09-24T09:21:15","date_gmt":"2021-09-24T09:21:15","guid":{"rendered":"https:\/\/matob.web.id\/news\/?p=1003"},"modified":"2021-09-24T09:44:45","modified_gmt":"2021-09-24T09:44:45","slug":"data-types-programmers-must-know","status":"publish","type":"post","link":"https:\/\/matob.web.id\/news\/data-types-programmers-must-know\/","title":{"rendered":"Data Types Programmers Must Know"},"content":{"rendered":"<p>Are you planning to become a programmer?\u00a0If so, you need to learn data types first.<\/p>\n<p>Why is that?\u00a0Because the data type is a classification that\u00a0<strong>determines how you will use the data in the program<\/strong>\u00a0.<\/p>\n<p>So, by using the right data type, the program you create will run smoothly.<\/p>\n<p>Well, actually there are so many programming data types themselves.\u00a0But in this article we will only discuss the most common types, namely types that fall into the\u00a0<strong>primitive<\/strong>\u00a0and\u00a0<strong>composite<\/strong>\u00a0categories\u00a0.<\/p>\n<p>Within these two categories, there are six commonly used <a href=\"https:\/\/matob.web.id\/news\/data-types-programmers-must-know\/\">data types<\/a>, namely:<\/p>\n<ol>\n<li><em>Integer<\/em>\u00a0(\u00a0<em>integer<\/em>\u00a0)<\/li>\n<li>Fractional numbers (\u00a0<em>floating point<\/em>\u00a0)<\/li>\n<li>Karakter (\u00a0<em>Char<\/em>\u00a0)<\/li>\n<li>Boolean<\/li>\n<li>String<\/li>\n<li>Array<\/li>\n<\/ol>\n<p>Have you ever heard of the six data types? Want to know more? Let&#8217;s see in the next section!<\/p>\n<h2><span id=\"6_Tipe_Data_yang_Perlu_Dipelajari_Programmer\">6 Data Types Programmers Need to Learn<\/span><\/h2>\n<p>We will now discuss the details of each type.\u00a0First, we will discuss four data types that fall into the primitive category, namely\u00a0<strong>integer, floating point, char,<\/strong>\u00a0and\u00a0<strong>boolean<\/strong>\u00a0.<\/p>\n<p>Finally, we will discuss two types that fall into the composite category, namely\u00a0<strong>strings<\/strong>\u00a0and\u00a0<strong>arrays<\/strong>\u00a0.<\/p>\n<p>Here are the differences between primitive data and composite data:<\/p>\n<ul>\n<li><strong>Primitive<\/strong>\u00a0&#8211; This type is generally a\u00a0<em>built-in<\/em>\u00a0of a\u00a0programming language\u00a0.<\/li>\n<li><strong>Composite<\/strong>\u00a0&#8211; This type is a combination of primitive data.\u00a0This type of combination is also known as a data structure.<\/li>\n<\/ul>\n<p>OK, without further ado, let&#8217;s get started!<\/p>\n<h3><span id=\"1_Bilangan_Bulat_Integer\">1. Integer (\u00a0<em>Integer<\/em>\u00a0)<\/span><\/h3>\n<p>Integers are used to\u00a0<strong>display numbers without decimal places<\/strong>\u00a0.\u00a0Examples such as 123, 85723, or 5. You can also use it for numbers that are minus as long as the number does not contain decimals, such as -19 or -2362.<\/p>\n<p>Well, there are four types of integers, namely\u00a0<strong>byte, short, int,<\/strong>\u00a0and\u00a0<strong>long<\/strong>\u00a0.\u00a0Here are the sizes and ranges of each type:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Data Type<\/strong><\/td>\n<td><strong>Size (bits)<\/strong><\/td>\n<td><strong>Range<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Byte<\/td>\n<td>8<\/td>\n<td>-128 to 127<\/td>\n<\/tr>\n<tr>\n<td>Short<\/td>\n<td>16<\/td>\n<td>-32768 to 32767<\/td>\n<\/tr>\n<tr>\n<td>Int<\/td>\n<td>32<\/td>\n<td>-2147483648 to 2147483647<\/td>\n<\/tr>\n<tr>\n<td>Long<\/td>\n<td>64<\/td>\n<td>-9223372036854775808 to 9223372036854775807<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>As you can see, the lower the data size and the higher the range.\u00a0Size is the volume of data, while range is the range of values.<\/p>\n<p>For example, suppose the data value is 200, then the data cannot fit into the\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Byte\" target=\"_blank\" rel=\"noreferrer noopener\">byte<\/a>\u00a0type\u00a0.\u00a0Because the byte range is only from -128 to 127 only.<\/p>\n<h3><span id=\"2_Bilangan_Pecahan_Floating_Point\">2. Fractions (\u00a0<em>Floating Point<\/em>\u00a0)<\/span><\/h3>\n<p>Next there are fractional numbers, aka\u00a0<em>floating point<\/em>\u00a0.\u00a0As the name implies, this type\u00a0<strong>displays numbers that contain decimals<\/strong>\u00a0.\u00a0Examples are 3.14, 7.5, or -5.6.<\/p>\n<p>Unlike\u00a0<em>integers, floating point<\/em>\u00a0only has two types, namely\u00a0<strong>float<\/strong>\u00a0and\u00a0<strong>double<\/strong>\u00a0.\u00a0They can be distinguished by their size, range, and number of digits:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Data Type<\/strong><\/td>\n<td><strong>Size (bits)<\/strong><\/td>\n<td><strong>Range<\/strong><\/td>\n<td><strong>Number of Digits<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Float<\/td>\n<td>32<\/td>\n<td>-3.4 x 1038 to 3.4 x 1038<\/td>\n<td>6 to 7 digits<\/td>\n<\/tr>\n<tr>\n<td>Double<\/td>\n<td>64<\/td>\n<td>-1.8 x 10308 to 1.8 x 10308<\/td>\n<td>15 digit<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<figure id=\"attachment_1005\" aria-describedby=\"caption-attachment-1005\" style=\"width: 711px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1005\" src=\"https:\/\/matob.web.id\/news\/wp-content\/uploads\/sites\/4\/2021\/09\/data-type.png\" alt=\"data type\" width=\"711\" height=\"346\" title=\"\" srcset=\"https:\/\/matob.web.id\/news\/wp-content\/uploads\/sites\/4\/2021\/09\/data-type.png 711w, https:\/\/matob.web.id\/news\/wp-content\/uploads\/sites\/4\/2021\/09\/data-type-300x146.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><figcaption id=\"caption-attachment-1005\" class=\"wp-caption-text\">example data type in C<\/figcaption><\/figure>\n<h3><span id=\"3_Karakter_Char\">3. Character ( <em>Char<\/em>\u00a0)<\/span><\/h3>\n<p>Unlike\u00a0<em>integers<\/em>\u00a0and\u00a0<em>floating point<\/em>\u00a0,\u00a0<strong><em>char<\/em><\/strong>\u00a0is a data type that allows you to store character information.<\/p>\n<p>The types of characters also vary.\u00a0Ranging from letters and numbers to special characters such as punctuation marks.<\/p>\n<p>In addition, this type also has no variations:<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Data Type<\/strong><\/td>\n<td><strong>Size (bits)<\/strong><\/td>\n<td><strong>Range<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Char<\/td>\n<td>16<\/td>\n<td>0 to 65535<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3><span id=\"4_Boolean\">4. Boolean<\/span><\/h3>\n<p>The last data primitive is a\u00a0<strong>boolean<\/strong>\u00a0.\u00a0This type is the simplest form.\u00a0Because its function is only to declare whether a value is\u00a0<em>true<\/em>\u00a0(\u00a0<em>true<\/em>\u00a0\/ 1) or\u00a0<em>false<\/em>\u00a0(\u00a0<em>false<\/em>\u00a0\/ 0).<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<tbody>\n<tr>\n<td><strong>Data Type<\/strong><\/td>\n<td><strong>Size (bits)<\/strong><\/td>\n<td><strong>Range<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Boolean<\/td>\n<td>\u2013<\/td>\n<td><em>True\/False<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3><span id=\"5_String\">5. String\u00a0<\/span><\/h3>\n<p>Okay, now we go to composite data.\u00a0The first composite data type we will cover is\u00a0<strong><em>string<\/em><\/strong>\u00a0.\u00a0Because\u00a0<strong><em>string<\/em><\/strong>\u00a0is one of the most popular types.<\/p>\n<p>If a\u00a0<em>char<\/em>\u00a0can only represent one character, a\u00a0<em>string<\/em>\u00a0can be used to store a set of characters.<\/p>\n<p>Here are the differences in the values \u200b\u200bof\u00a0<em>char<\/em>\u00a0and\u00a0<em>string<\/em>\u00a0:<\/p>\n<ul>\n<li>Char: A, B, C, 1, 2 dan 3<\/li>\n<li>String: &#8220;Hello World&#8221; or &#8220;Test 123&#8221;<\/li>\n<\/ul>\n<h3><span id=\"6_Array\">6. Array<\/span><\/h3>\n<p><strong><em>An array<\/em><\/strong>\u00a0is a data type that contains a set of variables of the same type.\u00a0So, if you see a set of data that is of a different type, it&#8217;s not<em>\u00a0an array<\/em>\u00a0.<\/p>\n<p>For example, suppose you store the values \u200b\u200b&#8221;C&#8221;, &#8220;D&#8221;, &#8220;E&#8221;, &#8220;F&#8221; and &#8220;G&#8221; in a variable of type\u00a0<em>array<\/em>\u00a0.\u00a0That is, the set of values \u200b\u200bcan also be called\u00a0<em>an array of characters<\/em>\u00a0.\u00a0This is because the values \u200b\u200b&#8221;C&#8221; to &#8220;G&#8221; are values \u200b\u200bof the same type, namely\u00a0<em>char<\/em>\u00a0.<\/p>\n<h2><span id=\"Gunakan_Tipe_Data_yang_Tepat_saat_Membangun_Program\">Use the Right Data Types when Building Programs!<\/span><\/h2>\n<p>Now you know which data type is right for a certain value or variable?\u00a0So, don&#8217;t use the wrong type, because this can affect the performance of the program you make.<\/p>\n<p>In addition to types, you also need to learn\u00a0<a href=\"https:\/\/matob.web.id\/news\/12-of-the-most-popular-programming-languages\/\">different types of programming languages<\/a>\u00a0.\u00a0Of course, the type of programming language you learn must also be in accordance with your\u00a0career path\u00a0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you planning to become a programmer?\u00a0If so, you need to learn data types first. Why is that?\u00a0Because the data type is a classification that\u00a0determines how you will use the data in the program\u00a0. So, by using the right data type, the program you create will run smoothly. Well, actually there are so many programming [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1004,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[233,234,163,164],"class_list":["post-1003","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-coding","tag-embeded-system","tag-programming","tag-programming-language"],"_links":{"self":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/comments?post=1003"}],"version-history":[{"count":0,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/posts\/1003\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/media\/1004"}],"wp:attachment":[{"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/media?parent=1003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/categories?post=1003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matob.web.id\/news\/wp-json\/wp\/v2\/tags?post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}