{"id":9559,"date":"2022-05-10T05:53:37","date_gmt":"2022-05-10T05:53:37","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=9559"},"modified":"2023-09-26T12:31:45","modified_gmt":"2023-09-26T07:01:45","slug":"microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 30| Variables naming rules and definition vs declaration"},"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: 30px; border-width: 0px; line-height: 50px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><strong>Variables naming rules and definition vs declaration<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; padding: 0em; 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=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; line-height: 36px; 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;\"><strong>Variables in C:<\/strong><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" 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;\">Variables are identifiers for your data.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Data are usually stored in computer memory.<\/span><\/li>\n<\/ul>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px;\"><span style=\"color: #ff99cc;\">#include<\/span>&lt;stdio.h&gt;\r\n\r\n<span style=\"color: #ff99cc;\">int<\/span> main()\r\n\r\n{\r\n  <span style=\"color: #008000;\"> \/* valueA and valueB are variables of type char *\/<\/span>\r\n   <span style=\"color: #ff99cc;\">char<\/span> valueA = 20;\r\n  <span style=\"color: #ff99cc;\"> char<\/span> valueB = 30;\r\n  <span style=\"color: #ff00ff;\"> printf<\/span>(\"Size = %d\\n\", <span style=\"color: #ff99cc;\">sizeof<\/span>(valueA));\r\n  <span style=\"color: #ff99cc;\"> return<\/span> 0;\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\">Small Code<\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; 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;\">For example, if you consider this small code, here, the 20 and 30 those are data. Those data must be stored inside the computer memory to manipulate them. <\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" 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;\">So, a variable acts as a label to a memory location where the data is stored.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Variable names are not stored inside the computer memory, and the compiler replaces them with memory location addresses during data manipulation.<\/span><\/li>\n<\/ul>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Variables are there just for your programming convenience. So, it is not part of the final machine instructions generated. Variable names will not be stored inside the computer memory. So, all those variable names will be replaced by their corresponding addresses when the compiler generates the instructions.&nbsp;<\/span><\/p>\n<p class=\"\">&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: #000080;\"><strong>Computer Memory Organization:<\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is how a typical a computer memory organization looks like. (Figure 1)<\/span><\/p>\n<figure id=\"attachment_9563\" aria-describedby=\"caption-attachment-9563\" style=\"width: 664px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-9563 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-2-6-1024x557.png\" alt=\"Figure 2. Computer memory organization\" width=\"664\" height=\"361\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-1024x557.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-300x163.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-768x418.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-600x326.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-1536x835.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-500x272.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-200x109.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-400x217.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-800x435.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6-1200x652.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.png 1889w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><figcaption id=\"caption-attachment-9563\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Computer memory organization<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Here, on the left-hand side, you see those are memory location addresses, also called pointers in C. And it shows different memory locations of the computer memory, and they are holding different values or data.<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">For instance, consider the 5th memory location. This memory location is of width 8 bits. That means that the memory location can store one byte of data. And if you want to store some data in that memory location or if you want to read the data from that memory location, you have to use its address. And the address of that memory location is 0x0803.<\/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;\">Memory location addresses can vary in size, depending on the computer architecture, such as 32 bits, 16 bits, or 8 bits.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s take an example of a memory location of the computer memory( as shown in Figure 2). Its address is 0x0800. And inside the memory location some value is stored. Here the variable name is valueA. This is just a name assigned to the memory location address to retrieve the data stored. So, the variable name just exists for programming convenience for the programmers and doesn&#8217;t exist post compilation, only its associated memory location address does.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">If a programmer wants to store some data into this memory location or if he wants to retrieve some data from this memory location, he just refers to the variable name associated with that memory location.&nbsp;<\/span><\/p>\n<figure id=\"attachment_9564\" aria-describedby=\"caption-attachment-9564\" style=\"width: 610px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9564\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-3-6-1024x535.png\" alt=\"C Programming Variables\" width=\"610\" height=\"319\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-1024x535.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-300x157.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-768x401.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-600x314.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-1536x803.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-120x63.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-500x261.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-200x105.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-400x209.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-800x418.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6-1200x627.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-3-6.png 1831w\" sizes=\"(max-width: 610px) 100vw, 610px\" \/><figcaption id=\"caption-attachment-9564\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Example of the memory location of the computer memory<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; 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: #000080;\"><strong><span style=\"text-decoration: underline;\">Defining variables:&nbsp;<\/span><\/strong><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; 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=\"\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Before you use a variable, you have to define it first.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">Variable definition(sometimes also called a variable declaration) is nothing more than letting the compiler know you will need some memory space for your program data so it can reserve some.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">To define a variable, you only need to state its type, followed by a variable name.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">e.g., if the data type of the variable is <\/span><b>char<\/b><span style=\"font-weight: 400;\">, then compiler reserves 1 byte. If the data type is <\/span><b>int<\/b><span style=\"font-weight: 400;\">, then compiler reserves 4 bytes.&nbsp;<\/span><\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 35px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><strong>Syntax of defining variables&nbsp;<\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">\u2018C\u2019 Syntax of variable definition:&nbsp;&nbsp;<\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800000;\"><b>&lt;data type&gt;&lt;variable_name&gt;;<\/b><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">You have to write its data type name first, and then write a variable name, so a meaningful variable name.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 24px; border-width: 0px; line-height: 34px; 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;\">Example:<\/span><\/strong><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800000;\"><b>Char<\/b><b> myExamScore;<\/b><\/span><\/p>\n<p class=\"\" style=\"padding-left: 40px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400;\">Here, <\/span><span style=\"color: #800000;\"><b>char<\/b><\/span> <span style=\"font-weight: 400; color: #000000;\">is a data type, and <\/span><span style=\"color: #800000;\"><b>myExamScore<\/b><\/span><span style=\"font-weight: 400; color: #000000;\"> is a variable name.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 37px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><strong>Variable initialization<\/strong><\/span><\/p>\n<figure id=\"attachment_9565\" aria-describedby=\"caption-attachment-9565\" style=\"width: 635px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9565\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-4-5-1024x322.png\" alt=\"C Programming Variables\" width=\"635\" height=\"200\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-1024x322.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-300x94.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-768x242.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-600x189.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-1536x483.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-120x38.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-500x157.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-200x63.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-400x126.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-800x252.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5-1200x377.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-5.png 1774w\" sizes=\"(max-width: 635px) 100vw, 635px\" \/><figcaption id=\"caption-attachment-9565\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Variable initialization<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Here, <\/span><b>char myExamScore<\/b><span style=\"font-weight: 400;\"> is a variable definition, and <\/span><b>myExamScore = 25<\/b><span style=\"font-weight: 400;\"> is a variable initialization, where you are assigning some value to the variable.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Remember that when the compiler generates instructions for these statements, the compiler will be generating instructions to put this value <\/span><b>25<\/b><span style=\"font-weight: 400;\"> into the memory location referred to by this variable name <\/span><b>myExamScore<\/b><span style=\"font-weight: 400;\">.&nbsp;<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Observe that variable initialization is followed by first defining the variable.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800000;\"><b>myExamScore = 25; \/\/<span style=\"color: #000000;\">variable initialization<\/span><\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800000;\"><b>Char<\/b><b> myExamScore;\/\/ <span style=\"color: #000000;\">variable definition<\/span><\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is an illegal statement. Here,&nbsp; first the variable is initialized, then the variable is defined. So, this is illegal.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">When the compiler compiles these statements, it sees that &#8220;myExamScore&#8221; which is not defined before getting assigned by a value. So, the compiler throws an error here.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #800000;\"><b>char<\/b> <b>myExamScore = 25;<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">This is a legal statement. Variable definition and variable initialization can be done in one single statement. The above statement is legal from the compiler point of view.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 35px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><strong>Rules for naming a variable<\/strong><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">There are a couple of rules you have to follow to write a meaningful variable name.<\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" 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;\">Variable names should not exceed 30 characters. Some compilers may produce errors for longer names..<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">A variable name can only contain alphabets (both uppercase and lowercase), digits and underscore.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The first letter of the variable cannot be a digit. It should be either an alphabet or underscore.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">You cannot use \u2018C\u2019 standard reserved keywords as variable names.<\/span><\/li>\n<\/ul>\n<figure id=\"attachment_9566\" aria-describedby=\"caption-attachment-9566\" style=\"width: 658px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9566 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-5-4-1024x618.png\" alt=\"Figure 5. C99 reserved keywords\" width=\"658\" height=\"397\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-1024x618.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-300x181.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-768x463.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-600x362.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-1536x926.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-120x72.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-500x302.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-200x121.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-400x241.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-800x482.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4-1200x724.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-5-4.png 1577w\" sizes=\"(max-width: 658px) 100vw, 658px\" \/><figcaption id=\"caption-attachment-9566\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. C99 reserved keywords<\/span><\/figcaption><\/figure>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">These are the C99 reserved keywords. This table I took from the C99 standard. In section 6.4.1, it is mentioned these are the reserved keywords, and these keywords you should not use as a variable name.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 21px; line-height: 30px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><strong><span style=\"text-decoration: underline;\"><span style=\"color: #000080; text-decoration: underline;\">Examples of legal and illegal variable definitions:<\/span><\/span><\/strong><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Here are a couple of examples of legal and illegal variable definitions.<\/span><\/p>\n<figure id=\"attachment_9567\" aria-describedby=\"caption-attachment-9567\" style=\"width: 621px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-9567\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-6-2-1024x804.png\" alt=\"C Programming Variables\" width=\"621\" height=\"488\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-1024x804.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-300x236.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-768x603.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-600x471.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-120x94.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-500x393.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-200x157.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-400x314.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2-800x628.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-2.png 1191w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><figcaption id=\"caption-attachment-9567\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Examples of legal and illegal variable definitions<\/span><\/figcaption><\/figure>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" 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;\">First of all, the first one is legal actually because it started with the underscore here. But it is not a meaningful variable name. So, avoid doing all these things.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">The second one is illegal because it actually started with a digit.&nbsp;&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><b>int_myAge;<\/b><span style=\"font-weight: 400;\"> This is also legal because it started with an underscore.<\/span><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><b>int %_temperatureValue;<\/b><span style=\"font-weight: 400;\"> This is illegal because it started with a special character. And only underscore is allowed as a special character. That&#8217;s why this is illegal.&nbsp;<\/span><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><b>int my car number;<\/b><span style=\"font-weight: 400;\"> this is also illegal because here you have a special character that is space, which is not allowed.&nbsp;<\/span><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><b>int 1456 <\/b><span style=\"font-weight: 400;\">is also illegal because it started with a digit.<\/span><\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 25px; border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; line-height: 37px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"text-decoration: underline; color: #000080;\"><strong>The difference between variable definition and declaration:<\/strong><\/span><\/p>\n<ul class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" 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;\">Variable is defined when the compiler generates instructions to allocate the storage for the variable.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">A variable is declared when the compiler is informed that a variable exists along with its type. The compiler does not generate any instructions to allocate the storage for the variable at that point.&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #000000;\">A variable definition is also a declaration, but not all variable declarations are definitions.<\/span><\/li>\n<\/ul>\n<p>&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&nbsp; 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>.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 34px; 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=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span><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; Variables naming rules and definition vs declaration &nbsp; &nbsp; &nbsp; Variables in C: Variables are identifiers for your data. Data are usually stored in computer memory. #include&lt;stdio.h&gt; int main() { \/* valueA and valueB are variables of type char *\/ char valueA = 20; char valueB = 30; printf(&#8220;Size = %d\\n&#8221;, sizeof(valueA)); return 0; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9563,"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-9559","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>Variables Naming Rules and the Difference Between Definition and Declaration<\/title>\n<meta name=\"description\" content=\"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into\" \/>\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-30-variables-naming-rules-and-definition-vs-declaration\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Variables Naming Rules and the Difference Between Definition and Declaration\" \/>\n<meta property=\"og:description\" content=\"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/\" \/>\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-05-10T05:53:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-26T07:01:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1889\" \/>\n\t<meta property=\"og:image:height\" content=\"1027\" \/>\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-30-variables-naming-rules-and-definition-vs-declaration\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 30| Variables naming rules and definition vs declaration\",\"datePublished\":\"2022-05-10T05:53:37+00:00\",\"dateModified\":\"2023-09-26T07:01:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/\"},\"wordCount\":1129,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-2-6.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-30-variables-naming-rules-and-definition-vs-declaration\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/\",\"name\":\"Variables Naming Rules and the Difference Between Definition and Declaration\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-2-6.png\",\"datePublished\":\"2022-05-10T05:53:37+00:00\",\"dateModified\":\"2023-09-26T07:01:45+00:00\",\"description\":\"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-2-6.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-2-6.png\",\"width\":1889,\"height\":1027,\"caption\":\"Figure 2. Computer memory organization\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 30| Variables naming rules and definition vs declaration\"}]},{\"@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":"Variables Naming Rules and the Difference Between Definition and Declaration","description":"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into","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-30-variables-naming-rules-and-definition-vs-declaration\/","og_locale":"en_US","og_type":"article","og_title":"Variables Naming Rules and the Difference Between Definition and Declaration","og_description":"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into","og_url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-05-10T05:53:37+00:00","article_modified_time":"2023-09-26T07:01:45+00:00","og_image":[{"width":1889,"height":1027,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.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-30-variables-naming-rules-and-definition-vs-declaration\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 30| Variables naming rules and definition vs declaration","datePublished":"2022-05-10T05:53:37+00:00","dateModified":"2023-09-26T07:01:45+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/"},"wordCount":1129,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.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-30-variables-naming-rules-and-definition-vs-declaration\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/","url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/","name":"Variables Naming Rules and the Difference Between Definition and Declaration","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.png","datePublished":"2022-05-10T05:53:37+00:00","dateModified":"2023-09-26T07:01:45+00:00","description":"Learn about naming rules for variables in C programming, understand the process of variable definition vs. declaration, and get insights into","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-6.png","width":1889,"height":1027,"caption":"Figure 2. Computer memory organization"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-30-variables-naming-rules-and-definition-vs-declaration\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 30| Variables naming rules and definition vs declaration"}]},{"@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\/9559","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=9559"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9559\/revisions"}],"predecessor-version":[{"id":16068,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9559\/revisions\/16068"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/9563"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=9559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=9559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=9559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}