{"id":1631,"date":"2020-10-20T19:58:37","date_gmt":"2020-10-20T19:58:37","guid":{"rendered":"https:\/\/sezeromer.com\/?p=1631"},"modified":"2023-03-04T13:18:35","modified_gmt":"2023-03-04T10:18:35","slug":"reference-type-vs-value-type","status":"publish","type":"post","link":"https:\/\/sezeromer.com\/en\/reference-type-vs-value-type\/","title":{"rendered":"Reference Type vs Value Type"},"content":{"rendered":"<p>Hello friends. In this article, we will talk about <strong>Reference Type<\/strong> and <strong>Value Type<\/strong> variables. Although we do not pay much attention while coding, it is an important issue in the software world.<\/p>\n<p>One of our projects is to create variables. While creating this variable, we are actually using the <strong>Reference Type<\/strong> and <strong>Value Type<\/strong> without realizing it.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;swift&quot;,&quot;mime&quot;:&quot;text\/x-swift&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">int x = 44;\r\n\r\nbool isLoading = false;<\/pre>\n<\/div>\n<p>As you can see above, these types of variables that we create in our projects are <strong>Value Type<\/strong> variables.<\/p>\n<p>&nbsp;<\/p>\n<p>But if we are deriving an object from a class, this is the Reference Type variable.<\/p>\n<p>&nbsp;<\/p>\n<p>The differences between;<\/p>\n<ul>\n<li>Value Type variables carry the value directly inside, whereas Reference Type variables keep only the reference, as the name suggests.<\/li>\n<li>Value Type variables cannot take a null value, while Reference Type variables can take a null value.<\/li>\n<li>Value Type variables are kept in the stack region of Ram, while Reference Type variables are kept in the heap region of Ram.<\/li>\n<\/ul>\n<h3>Value Type Variables<\/h3>\n<ul>\n<li>int<\/li>\n<li>long<\/li>\n<li>float<\/li>\n<li>double<\/li>\n<li>decimal<\/li>\n<li>char<\/li>\n<li>bool<\/li>\n<li>byte<\/li>\n<li>short<\/li>\n<li>struct<\/li>\n<li>enum<\/li>\n<\/ul>\n<h3>Reference Type Variables<\/h3>\n<ul>\n<li>string<\/li>\n<li>s\u0131n\u0131flar<\/li>\n<li>delegeler<\/li>\n<li>diziler<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Actually, as you can see, they are separated from each other very simply. Good work everyone.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hello friends. In this article, we will talk about Reference Type and Value Type variables. Although we do not pay much attention while coding, it is an important issue in the software world. One of our projects is to create variables. While creating this variable, we are actually using the Reference Type and Value Type [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1304,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[638,639,636,336,635,633,637,338,634],"class_list":["post-1631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c-ile-ilgili-yazilar","tag-bool","tag-class","tag-heap","tag-int","tag-ram","tag-referece-type","tag-stack","tag-string","tag-value-type"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1631"}],"collection":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/comments?post=1631"}],"version-history":[{"count":3,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1631\/revisions"}],"predecessor-version":[{"id":2654,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1631\/revisions\/2654"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media\/1304"}],"wp:attachment":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media?parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/categories?post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/tags?post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}