{"id":9657,"date":"2022-05-17T03:42:33","date_gmt":"2022-05-17T03:42:33","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=9657"},"modified":"2023-09-23T17:21:17","modified_gmt":"2023-09-23T11:51:17","slug":"storage-class-specifiers-in-c","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 37| Storage class specifiers in &#8216;C&#8217;"},"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 color4-background-color color-4-text-contrast bg-background-color\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 50px;\"><span style=\"color: #000080;\"><strong>Storage class specifiers in &#8216;C&#8217;<\/strong><\/span><\/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=\"\">&nbsp;<\/p>\n<h2 style=\"font-size: 25px; border-width: 0px; line-height: 35px;\"><span style=\"text-decoration: underline; color: #000080;\">Type Storage Classes in &#8216;C&#8217; Language decides:<\/span><\/h2>\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: #002f80;\">Scope of a variable<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #002f80;\">Visibility of a variable or function&nbsp;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400; color: #002f80;\">Lifetime of a variable<\/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: #ff0000;\">Scope<\/span><span style=\"font-weight: 400; color: #000000;\">, <\/span><span style=\"font-weight: 400; color: #ff0000;\">visibility<\/span><span style=\"font-weight: 400;\"><span style=\"color: #000000;\">,<\/span> <span style=\"color: #000000;\">and <\/span><\/span><span style=\"font-weight: 400; color: #ff0000;\">lifetime <\/span><span style=\"font-weight: 400; color: #000000;\">are features of a variable. These features can be modified by using storage class specifiers.<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<h3 class=\"\" style=\"font-size: 25px; border-width: 0px; line-height: 35px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"text-decoration: underline; color: #000080;\">2 widely used storage class specifiers in \u2018C\u2019<\/span><\/h3>\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=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"http:\/\/fastbitlab.com\/use-cases-of-static-with-variables\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">static<\/span><\/a><\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"http:\/\/fastbitlab.com\/microcontroller-embedded-c-programming-lecture-40-extern-storage-class-specifier\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">extern<\/span><\/a><\/span><\/li>\n<\/ul>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"font-size: 22px; 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>The &#8216;static&#8217; Storage Class Specifier<\/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;\">Now, let&#8217;s first understand the Static keyword in C. We will understand this by using an example.&nbsp;<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\"><span style=\"color: #ff99cc;\">#include<\/span>&lt;stdio.h&gt;\r\n\r\n<span style=\"color: #008000;\">\/*this is a function prototype*\/<\/span>\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>);\r\n\r\n<span style=\"color: #ff99cc;\">int<\/span> main()\r\n\r\n{\r\n   myFun1();\r\n   myFun1();\r\n   myFun1();\r\n   myFun1();\r\n<span style=\"color: #ff99cc;\">   return<\/span> 0;\r\n}\r\n\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n<span style=\"color: #ff99cc;\">   int<\/span> count = 0;\r\n   count = count +1;\r\n<span style=\"color: #ff00ff;\">   printf<\/span>(\"This function executed %d time(s)\\n\", count);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Static storage class specifier in \u2018C\u2019 example<\/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;\">Here I have a function called <\/span><b>main()<\/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=\"color: #000000;\"><span style=\"font-weight: 400;\">Now let me create one more function called <\/span><b>myFun1<\/b><span style=\"font-weight: 400;\">, which doesn&#8217;t return anything and doesn&#8217;t take any arguments. All are <strong>void<\/strong>. So, <\/span><b>void myFun1(void) <\/b><\/span><span style=\"font-weight: 400; color: #000000;\">And now, let&#8217;s give the prototype of that function and end this statement with a semicolon.&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=\"color: #000000;\"><span style=\"font-weight: 400;\">This program aims to count how many times <\/span><b>myFun1<\/b><span style=\"font-weight: 400;\"> is called from the main function. Call this function from the main couple of times. And I&#8217;m calling <\/span><b>myFun1<\/b><span style=\"font-weight: 400;\"> 4 times, as shown above.<\/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;\">And this function has to print how many times this function gets called. For that, to count, let me use one variable <\/span><b>int count<\/b><span style=\"font-weight: 400;\">. Now let me initialize this to 0 and increment the count by 1, <\/span><b>count + 1<\/b><span style=\"font-weight: 400;\">. So, whenever this function is called, the count will be incremented by 1.&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;\">After that, I&#8217;m going to print that count value. <\/span><b>Printf(&#8220;This function executed %d time(s)\\n&#8221;);<\/b><span style=\"font-weight: 400;\"> after that, give the argument that is this variable name <\/span><b>count<\/b><span style=\"font-weight: 400;\">. The goal of this application is to print how many times this function gets executed.&nbsp;<\/span><\/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=\"font-weight: 400; color: #000000;\">Let&#8217;s run the program. Look at Figure 1, what&#8217;s happening here? Everywhere it says that This function is executed 1 time, 1 time, 1 time. But our goal is to count how many times this function gets executed.&nbsp;<\/span><\/p>\n<figure id=\"attachment_9661\" aria-describedby=\"caption-attachment-9661\" style=\"width: 722px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-9661 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-2-12.png\" alt=\"Figure 2. Output of the Program\" width=\"722\" height=\"373\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12.png 941w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-300x155.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-768x397.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-600x310.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-500x258.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-200x103.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-400x207.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-2-12-800x413.png 800w\" sizes=\"(max-width: 722px) 100vw, 722px\" \/><figcaption id=\"caption-attachment-9661\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. Output of the Program<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&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;\">First, analyze what&#8217;s happening in this program. Let&#8217;s start with the main because execution starts with the main. Inside the main body, so we have first there is a call to myFun1. So, control comes here(line 29).&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;\">And when it comes here, a local variable is created and initialized to 0. After that, 0 is incremented by 1, and then the value is stored back into the variable count. The count is 1. And printf prints the value that is 1.&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=\"color: #000000;\"><span style=\"font-weight: 400;\">After that, this function returns. The moment the execution control goes out of this function, what happens is that<\/span><b> int count = 0;<\/b><span style=\"font-weight: 400;\"> this local variable dies. The memory location associated with that variable is removed, and the value is lost. So, the<\/span><b> int count =0 <\/b><span style=\"font-weight: 400;\">variable loses its existence.&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;\">And then, the function returns to main() again, and after that, there is one more call to the same function(myFun1). And the control again comes to the main function(line 29), again the variable count is created, and it is initialized to 0, and again that 0 is incremented by 1, and again it prints 1 here. So, it happens like that.&nbsp;<\/span><\/p>\n<p 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=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">But, our goal is to <\/span><b>count<\/b><span style=\"font-weight: 400;\">. We don&#8217;t want the count variable to die. We want this variable to hold its last value across multiple function calls. <\/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;\">How do you achieve that?<\/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;\">This problem can be easily solved by removing the<\/span><b> int count =0<\/b><span style=\"font-weight: 400;\"> variable from local space and moving that variable to global space. So now, the count variable is moved to global space, so global variables will not die until you terminate the application. So, their lifetime is until you terminate the application, the global variable will be there, and their scope is visible to all the functions.&nbsp;<\/span><\/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\r\n<span style=\"color: #008000;\">\/*this is a function prototype*\/<\/span>\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>);\r\n<span style=\"color: #ff99cc;\">int<\/span> count = 0;\r\n<span style=\"color: #ff99cc;\">int<\/span> main()\r\n\r\n{\r\n   myFun1();\r\n   myFun1();\r\n   myFun1();\r\n   myFun1();\r\n<span style=\"color: #ff99cc;\">   return<\/span> 0;\r\n}\r\n\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n  count = count +1;\r\n<span style=\"color: #ff00ff;\">  printf<\/span>(\"This function executed %d time(s)\\n\", count);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">Modified program<\/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;\">Let&#8217;s run once again.&nbsp;<\/span><\/p>\n<figure id=\"attachment_9663\" aria-describedby=\"caption-attachment-9663\" style=\"width: 719px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9663 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-4-10.png\" alt=\"Figure 4. Output\" width=\"719\" height=\"535\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10.png 1007w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-300x223.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-768x571.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-600x446.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-120x89.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-500x372.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-200x149.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-400x298.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-4-10-800x595.png 800w\" sizes=\"(max-width: 719px) 100vw, 719px\" \/><figcaption id=\"caption-attachment-9663\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Output<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&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;\">Now, the problem is solved. This function is executed 1 time, 2 times, 3 times, 4 times. So, it is now correctly printed. So, this is what we expected.&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;\">But, there is a small problem. The problem is now you made this variable public. Any function in the program can modify this variable. So, even this variable can be modified by some other file of the project. So, this is completely public to all the functions of your project. That is not good.<\/span><\/p>\n<blockquote class=\"\">\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #ff0000;\"><i><span style=\"font-weight: 400;\">Now our requirement for this program is, we want a global variable that is private to a function. We want a private variable that does not lose its existence even if the execution control goes out of the scope of that variable.&nbsp;<\/span><\/i><\/span><\/p>\n<\/blockquote>\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;\">In order to achieve this requirement, that is we want a global variable but it should be private to a function. So, this can be achieved in &#8216;C&#8217; by using a storage class specifier called static.&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=\"color: #000000;\"><span style=\"font-weight: 400;\">Let&#8217;s see how to use that. Let&#8217;s go back to the function. Now again remove <\/span><b>int count =0<\/b><span style=\"font-weight: 400;\"> this variable definition from global space, and let&#8217;s move that into the local space again. Use the static keyword here. <\/span><b>static int count = 0<\/b><span style=\"font-weight: 400;\">; Now, the<\/span><b> count<\/b><span style=\"font-weight: 400;\"> is a global variable, but it is private to the <\/span><b>myFun1<\/b><span style=\"font-weight: 400;\">.&nbsp;<\/span><\/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\r\n<span style=\"color: #008000;\">\/*this is a function prototype*\/<\/span>\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>);\r\n\r\n<span style=\"color: #ff99cc;\">int<\/span> main()\r\n{\r\n  myFun1();\r\n  myFun1();\r\n  myFun1();\r\n  myFun1();\r\n<span style=\"color: #ff99cc;\">  return<\/span> 0;\r\n}\r\n\r\n<span style=\"color: #ff99cc;\">void<\/span> myFun1(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n  static int count = 0;\r\n  count = count +1;\r\n<span style=\"color: #ff00ff;\">  printf<\/span>(\"This function executed %d time(s)\\n\", count);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\"> Used static storage class specifiers in c<\/span><\/p>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&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 run this program to see how it goes.&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;\">You see Figure 3; we got the expected result. But, in this case, this count variable is accessible only from myFun1, not from other functions.<\/span><\/p>\n<figure id=\"attachment_9665\" aria-describedby=\"caption-attachment-9665\" style=\"width: 722px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-9665 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/05\/Figure-6-6-1024x606.png\" alt=\"Figure 6. Output \" width=\"722\" height=\"428\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-1024x606.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-300x177.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-768x454.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-600x355.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-120x71.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-500x296.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-200x118.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-400x237.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-800x473.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6-1200x710.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-6-6.png 1429w\" sizes=\"(max-width: 722px) 100vw, 722px\" \/><figcaption id=\"caption-attachment-9665\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Output<\/span><\/figcaption><\/figure>\n<p class=\"\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&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: #000000;\"><span style=\"font-weight: 400;\">And also, remember that the<\/span><b> count<\/b><span style=\"font-weight: 400;\"> variable will not die even if the execution control goes out of this function. The scope of this variable is now global, but visibility is only for this function. So, we will understand more about static storage class specifiers in the following article.<\/span><\/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 Microcontroller Embedded C Programming Full Course on<\/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=\"border-width: 0px; font-size: 20px;\"><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;\">lick here:&nbsp;<\/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; Storage class specifiers in &#8216;C&#8217; &nbsp; &nbsp; &nbsp; Type Storage Classes in &#8216;C&#8217; Language decides: Scope of a variable Visibility of a variable or function&nbsp; Lifetime of a variable Scope, visibility, and lifetime are features of a variable. These features can be modified by using storage class specifiers. &nbsp; 2 widely used storage class [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9660,"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-9657","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>Storage Class Specifiers in C- static, extern(with Examples)<\/title>\n<meta name=\"description\" content=\"Learn about the significance of storage class specifiers in C programming, including the &#039;static&#039; and &#039;extern&#039; keywords. Variable scope,\" \/>\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\/storage-class-specifiers-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Storage Class Specifiers in C- static, extern(with Examples)\" \/>\n<meta property=\"og:description\" content=\"Learn about the significance of storage class specifiers in C programming, including the &#039;static&#039; and &#039;extern&#039; keywords. Variable scope,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/\" \/>\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-17T03:42:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-23T11:51:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1157\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 37| Storage class specifiers in &#8216;C&#8217;\",\"datePublished\":\"2022-05-17T03:42:33+00:00\",\"dateModified\":\"2023-09-23T11:51:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/\"},\"wordCount\":988,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-1-12.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/\",\"name\":\"Storage Class Specifiers in C- static, extern(with Examples)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-1-12.png\",\"datePublished\":\"2022-05-17T03:42:33+00:00\",\"dateModified\":\"2023-09-23T11:51:17+00:00\",\"description\":\"Learn about the significance of storage class specifiers in C programming, including the 'static' and 'extern' keywords. Variable scope,\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-1-12.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/Figure-1-12.png\",\"width\":1157,\"height\":720,\"caption\":\"Figure 1. static storage class specifier in \u2018C\u2019 example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/storage-class-specifiers-in-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 37| Storage class specifiers in &#8216;C&#8217;\"}]},{\"@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":"Storage Class Specifiers in C- static, extern(with Examples)","description":"Learn about the significance of storage class specifiers in C programming, including the 'static' and 'extern' keywords. Variable scope,","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\/storage-class-specifiers-in-c\/","og_locale":"en_US","og_type":"article","og_title":"Storage Class Specifiers in C- static, extern(with Examples)","og_description":"Learn about the significance of storage class specifiers in C programming, including the 'static' and 'extern' keywords. Variable scope,","og_url":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-05-17T03:42:33+00:00","article_modified_time":"2023-09-23T11:51:17+00:00","og_image":[{"width":1157,"height":720,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 37| Storage class specifiers in &#8216;C&#8217;","datePublished":"2022-05-17T03:42:33+00:00","dateModified":"2023-09-23T11:51:17+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/"},"wordCount":988,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/","url":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/","name":"Storage Class Specifiers in C- static, extern(with Examples)","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.png","datePublished":"2022-05-17T03:42:33+00:00","dateModified":"2023-09-23T11:51:17+00:00","description":"Learn about the significance of storage class specifiers in C programming, including the 'static' and 'extern' keywords. Variable scope,","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/05\/Figure-1-12.png","width":1157,"height":720,"caption":"Figure 1. static storage class specifier in \u2018C\u2019 example"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/storage-class-specifiers-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 37| Storage class specifiers in &#8216;C&#8217;"}]},{"@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\/9657","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=9657"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9657\/revisions"}],"predecessor-version":[{"id":16053,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/9657\/revisions\/16053"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/9660"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=9657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=9657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=9657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}