{"id":12226,"date":"2022-11-08T08:10:53","date_gmt":"2022-11-08T08:10:53","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=12226"},"modified":"2023-09-20T15:30:09","modified_gmt":"2023-09-20T10:00:09","slug":"microcontroller-embedded-c-programming-lecture-129-const-type-qualifier","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 129| &#8216;const&#8217; type qualifier"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 35px; border-width: 0px; line-height: 50px;\"><strong><span style=\"color: #000080;\">&#8216;const&#8217; type qualifier<\/span><\/strong><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline;\"><span style=\"color: #000080; text-decoration: underline;\"><b>Type qualifiers in \u2018C\u2019<\/b><\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are two important type qualifiers in &#8216;C&#8217;.&nbsp;<\/span><\/p>\n<ol class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #eb1745;\"><strong>const&nbsp;<\/strong><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #eb1745;\"><strong>volatile<\/strong><\/span><\/li>\n<\/ol>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\">Applying these qualifiers to&nbsp; a variable declarations&nbsp; is called<span style=\"color: #eb1745;\"><strong> <i>qualifying<\/i><\/strong> <\/span>the declarations. <\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">These are very important qualifiers you should understand to write proper and bug free code for your embedded device.&nbsp;<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 20px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #eb1745;\"><strong>Definition of &#8216;qualifier&#8217;:<\/strong><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">The English meaning of the word &#8216;<span style=\"color: #eb1745;\"><strong>qualifier<\/strong><\/span>&#8216; is a word or phrase, especially an adjective, used to attribute a quality to another word, especially a noun.&nbsp;&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In programming, also the same case. We use &#8216;const&#8217; and &#8216;volatile&#8217; qualifiers to attribute a feature to a variable.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><b><span style=\"color: #eb1745; text-decoration: underline;\">&#8216;const&#8217;<\/span> type qualifier:<\/b><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\"><span style=\"color: #eb1745;\">&#8216;const&#8217;<\/span> is a type qualifier in &#8216;C&#8217; used to enforce read-only features on variables. <\/span>When you define a variable as &#8216;const,&#8217; it becomes a read-only variable, meaning its value cannot be modified after initialization.<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Consider the following example:<\/span><\/p>\n<p class=\"\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-12229 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/11\/Fig-1.png\" alt=\"\" width=\"660\" height=\"174\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1.png 1686w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-300x79.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-1024x268.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-768x201.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-600x157.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-1536x403.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-200x52.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-400x105.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-800x210.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Fig-1-1200x315.png 1200w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Now consider <span style=\"color: #ff0000;\">uint8_t data1 =10<\/span> variable definition. Here, &#8216;data1&#8217; is a variable of type uint8 and that is initialized to 10. And in the program, you can modify the value of that variable, which is allowed. So, the &#8216;data1&#8217; value can be modified throughout the program. No issues with that.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But when you use &#8216;const&#8217; qualifier with a variable definition, then this variable changes, it becomes read-only. <span style=\"color: #ff0000;\">uint8_t const data2 =10;<\/span>&nbsp; Here &#8216;data2&#8217; is called a constant variable or read-only variable.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And in the program, if you try to change the value of the data2 variable, then this will trigger a compilation error. This is not allowed. So, you have to initialize that variable when you define it. After that, you are not allowed to change the value of that variable. Because now it is a read-only variable.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s analyze the below statement. <\/span><\/p>\n<figure id=\"attachment_12230\" aria-describedby=\"caption-attachment-12230\" style=\"width: 566px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-12230\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/11\/Figure-1-1-1024x506.png\" alt=\"const type qualifier\" width=\"566\" height=\"280\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-1024x506.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-300x148.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-768x380.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-600x297.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-1536x760.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-200x99.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-400x198.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-800x396.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1-1200x593.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-1-1.png 1737w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><figcaption id=\"caption-attachment-12230\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Analyze the statement<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here uint8_t is the data type, we also call it as type specifier of a variable. \u2018const\u2019 is a type qualifier of a variable. And data1 is a variable and in this case, it is a read-only variable.&nbsp; And here the value of the data1 is 10 and it is fixed at 10. The value of the data1 can&#8217;t be modified.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s understand the syntax of how you should use this &#8216;const&#8217; keyword in the variable definition. <\/span><\/p>\n<figure id=\"attachment_12231\" aria-describedby=\"caption-attachment-12231\" style=\"width: 525px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-12231 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/11\/Figure-2-1-1024x408.png\" alt=\"Figure 2. Syntax \" width=\"525\" height=\"209\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-1024x408.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-300x120.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-768x306.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-600x239.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-1536x612.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-200x80.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-400x159.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-800x319.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1-1200x478.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png 1729w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><figcaption id=\"caption-attachment-12231\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Syntax<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are two possible ways. <\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-size: 17px; line-height: 1.8em;\"><span style=\"font-weight: 400; color: #000000;\">You can either write it like <span style=\"color: #ff0000;\">const uint8_t data1 = 10;<\/span> <\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"padding-left: 40px; font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">That means you first start with a &#8216;const&#8217; that is a type qualifier, followed by a type specifier, followed by a variable name. You can do it like this, no problem.&nbsp;<\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-size: 17px; line-height: 1.8em;\"><span style=\"font-weight: 400; color: #000000;\">Or you can also do like <span style=\"color: #ff0000;\">uint8_t const data1 = 10;<\/span> <\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"padding-left: 40px; font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">First start with the type specifier, followed by the type qualifier that is &#8216;const&#8217;, and then the variable name.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, the &#8216;const&#8217; keyword can appear before the type specifier or after the type specifier. Both are allowed. That&#8217;s why, both statements are identical, no issues with that.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But, I usually prefer the second method, that is first you mentioned the data type which is the type specifier, and then the type qualifier. Because it helps you to understand complex statements better.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here, if you want to understand or convert uint8_t const data1 = 10 this statement into English, then you should first identify the variable name. data1 is a variable name and then moves to your left-hand side. So, this is how you should read it.&nbsp; Data1 is a constant variable of type uint8. So, that&#8217;s how you should read it. So, it helps you to read the statement better, that&#8217;s why always start with the type specifier.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; line-height: 45px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><span><b>About <span style=\"color: #eb1745; text-decoration: underline;\">\u201cconst\u201d<\/span>ness of a variable<\/b><\/span><\/span><\/p>\n<ul class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">By using the &#8216;const&#8217; keyword, you are just making a promise to the compiler that you(the programmer) won&#8217;t try to modify the content of the variable using its name.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">If you try to modify the variable by its name, the compiler stops you by throwing an error.<\/span><span style=\"font-weight: 400;\">(compile time error)<\/span><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">You can still modify the content of the variable by using its address.&nbsp;<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">&#8216;const&#8217; variable means that you cannot change the value by its name, but you can change the value of that variable by its address.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s look at the below small program to understand the constants of a variable.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #ff99cc;\">#include<\/span> &lt;stdio.h&gt;\r\n<span style=\"color: #ff99cc;\">#include<\/span> &lt;stdint.h&gt;\r\n\r\n<span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)&nbsp;\r\n{\r\n  <span style=\"color: #008000;\">  uint8_t<\/span> <span style=\"color: #ff99cc;\">const<\/span> data = 10;\r\n    data = 50;\r\n  <span style=\"color: #ff00ff;\">  printf<\/span>(\"Value = %u\\n\", data);\r\n    getchar();\r\n}<\/pre>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here, variable of type uint8_t data = 10; Let me make this read-only. So, I introduce a &#8216;<span style=\"color: #ff0000;\">const<\/span>&#8216; keyword here. I try to change the value of data = 50. Then print the value of that variable.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When I compile this code, it gives an error. The error says that,&nbsp; assignment of read-only variable \u2018data\u2019.&nbsp;<\/span><\/p>\n<figure id=\"attachment_12232\" aria-describedby=\"caption-attachment-12232\" style=\"width: 545px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-12232\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/11\/Figure-3.png\" alt=\"const type qualifier\" width=\"545\" height=\"308\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3.png 1426w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-300x170.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-1024x579.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-768x434.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-600x339.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-200x113.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-400x226.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-800x452.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-3-1200x678.png 1200w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><figcaption id=\"caption-attachment-12232\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. error<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">So, now data =50 has been converted into a read-only variable, that&#8217;s why the compiler is saying that this is not allowed.<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">But, still I can change the value of the data = 50. So, I simply create a pointer &#8216;ptr&#8217; and I initialize the pointer variable with the address of the variable.&nbsp; <\/span><span style=\"font-weight: 400; color: #000000;\">Then, I write whatever value I like into the address pointed by ptr. That&#8217;s why *ptr = 50. After that print the value here.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\"><span style=\"color: #ff99cc;\">#include<\/span> &lt;stdio.h&gt;\r\n<span style=\"color: #ff99cc;\">#include<\/span> &lt;stdint.h&gt;\r\n\r\n<span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n   <span style=\"color: #008000;\"> uint8_t<\/span> <span style=\"color: #ff99cc;\">const<\/span> data = 10;\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Value = %u\\n\",data);\r\n    <span style=\"color: #008000;\">uint8_t<\/span> *ptr = (<span style=\"color: #008000;\">uint8_t<\/span>*)&amp;data; <span style=\"color: #008000;\">\/\/uint8_t const *<\/span>\r\n    *ptr = 50;\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Value = %u\\n\",data);\r\n    getchar();\r\n}<\/pre>\n<figure id=\"attachment_12233\" aria-describedby=\"caption-attachment-12233\" style=\"width: 566px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-12233\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/11\/Figure-4-1024x609.png\" alt=\"const type qualifier\" width=\"566\" height=\"337\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-1024x609.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-300x178.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-768x457.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-600x357.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-200x119.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-400x238.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-800x476.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4-1200x714.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-4.png 1437w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><figcaption id=\"caption-attachment-12233\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Build successfully<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You should remember that &#8216;<span style=\"color: #ff0000;\">const<\/span>&#8216; doesn&#8217;t mean that the value never changes, it&#8217;s only a programming safety feature to ensure that the programmer shouldn&#8217;t try to modify the value.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Because the compiler alerts you if anyone tries to change the value of that variable by its name. That&#8217;s why &#8216;const&#8217; is used as a programming safety feature.&nbsp;<\/span><\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 20px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><strong><span style=\"text-decoration: underline;\">Conclusion:<\/span><\/strong><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">In summary, the &#8216;const&#8217; type qualifier in C is a valuable tool for indicating that a variable&#8217;s value should not be modified directly. It serves as a safety feature to catch attempts to modify the variable&#8217;s value by its name during compilation, making code more robust and reliable.<\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; line-height: 1.8em; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the following article, let&#8217;s understand the <a href=\"https:\/\/fastbitlab.com\/microcontroller-embedded-c-programming-lecture-130-placements-of-const-variables-in-memory\/\">placement of &#8216;const&#8217; variables in memory<\/a>.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 18px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #993366;\"><strong>Get the Full Course on Microcontroller Embedded C programming<\/strong> <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.udemy.com\/course\/microcontroller-embedded-c-programming\/\">Here<\/a>.<\/span><\/span><\/p>\n<p class=\"\" style=\"font-size: 23px; border-width: 0px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"font-size: 17px; border-width: 0px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\">lick here:<span style=\"color: #0000ff;\">&nbsp;<\/span><\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &#8216;const&#8217; type qualifier &nbsp; &nbsp; Type qualifiers in \u2018C\u2019 There are two important type qualifiers in &#8216;C&#8217;.&nbsp; const&nbsp; volatile Applying these qualifiers to&nbsp; a variable declarations&nbsp; is called qualifying the declarations. These are very important qualifiers you should understand to write proper and bug free code for your embedded device.&nbsp; &nbsp; Definition of &#8216;qualifier&#8217;: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12231,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[16],"class_list":["post-12226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-microcontroller-embedded-c-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>&#039;const&#039; type qualifier in C Programming | FastBit EBA<\/title>\n<meta name=\"description\" content=\"&#039;const&#039; type qualifier in C. There are two important type qualifiers in &#039;C&#039;. &#039;const&#039; and &#039;volatile&#039;. Discover its syntax, benefits, limitation\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"&#039;const&#039; type qualifier in C Programming | FastBit EBA\" \/>\n<meta property=\"og:description\" content=\"&#039;const&#039; type qualifier in C. There are two important type qualifiers in &#039;C&#039;. &#039;const&#039; and &#039;volatile&#039;. Discover its syntax, benefits, limitation\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-08T08:10:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-20T10:00:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1729\" \/>\n\t<meta property=\"og:image:height\" content=\"689\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 129| &#8216;const&#8217; type qualifier\",\"datePublished\":\"2022-11-08T08:10:53+00:00\",\"dateModified\":\"2023-09-20T10:00:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/\"},\"wordCount\":1048,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Figure-2-1.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/\",\"name\":\"'const' type qualifier in C Programming | FastBit EBA\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Figure-2-1.png\",\"datePublished\":\"2022-11-08T08:10:53+00:00\",\"dateModified\":\"2023-09-20T10:00:09+00:00\",\"description\":\"'const' type qualifier in C. There are two important type qualifiers in 'C'. 'const' and 'volatile'. Discover its syntax, benefits, limitation\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Figure-2-1.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/Figure-2-1.png\",\"width\":1729,\"height\":689,\"caption\":\"Figure 2. Syntax\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 129| &#8216;const&#8217; type qualifier\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"'const' type qualifier in C Programming | FastBit EBA","description":"'const' type qualifier in C. There are two important type qualifiers in 'C'. 'const' and 'volatile'. Discover its syntax, benefits, limitation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/","og_locale":"en_US","og_type":"article","og_title":"'const' type qualifier in C Programming | FastBit EBA","og_description":"'const' type qualifier in C. There are two important type qualifiers in 'C'. 'const' and 'volatile'. Discover its syntax, benefits, limitation","og_url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-11-08T08:10:53+00:00","article_modified_time":"2023-09-20T10:00:09+00:00","og_image":[{"width":1729,"height":689,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 129| &#8216;const&#8217; type qualifier","datePublished":"2022-11-08T08:10:53+00:00","dateModified":"2023-09-20T10:00:09+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/"},"wordCount":1048,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/","url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/","name":"'const' type qualifier in C Programming | FastBit EBA","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png","datePublished":"2022-11-08T08:10:53+00:00","dateModified":"2023-09-20T10:00:09+00:00","description":"'const' type qualifier in C. There are two important type qualifiers in 'C'. 'const' and 'volatile'. Discover its syntax, benefits, limitation","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/11\/Figure-2-1.png","width":1729,"height":689,"caption":"Figure 2. Syntax"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-129-const-type-qualifier\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 129| &#8216;const&#8217; type qualifier"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/12226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=12226"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/12226\/revisions"}],"predecessor-version":[{"id":12343,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/12226\/revisions\/12343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/12231"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=12226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=12226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=12226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}