{"id":1061,"date":"2018-08-23T01:33:37","date_gmt":"2018-08-23T01:33:37","guid":{"rendered":"https:\/\/www.gologica.com\/blog\/?p=1061"},"modified":"2025-04-06T03:12:27","modified_gmt":"2025-04-06T03:12:27","slug":"c-programming-basic-concepts","status":"publish","type":"post","link":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/","title":{"rendered":"C Programming Basic Concepts"},"content":{"rendered":"<p><strong>What is C language?<\/strong><\/p>\n<p>The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system.<\/p>\n<p><strong>What are the two types of Constants in C?<\/strong><\/p>\n<ol>\n<li>Primary Constants.<\/li>\n<li>Secondary Constants.<\/li>\n<\/ol>\n<p><strong>What is the difference between &#8220;printf(&#8230;)&#8221; and &#8220;sprintf(&#8230;)&#8221;?<\/strong><\/p>\n<p>sprintf(&#8230;) writes data to the character array whereas printf(&#8230;) writes data to the standard output device.<\/p>\n<p><strong>How to reduce a final size of executable?<\/strong><\/p>\n<p>Size of the final executable can be reduced using dynamic linking for libraries.<\/p>\n<p><strong>What is\u00a0hashing?<\/strong><\/p>\n<p>To hash means to grind up, and that\u2019s essentially what hashing is all about. The heart of a hashing algorithm is a hash function that takes your nice, neat data and grinds it into some random-looking integer.<\/p>\n<table style=\"background: #d9dde2;\">\n<tbody>\n<tr>\n<td style=\"border: 1px solid black;\">\n<h5 style=\"padding: 10px 10px 10px 10px;\"><strong> Are you Looking for C Programming Online Training? Please Enroll for Demo <a href=\" https:\/\/www.gologica.com\/course\/c-programming\/\"> C Programming..! <\/a><\/strong><\/h5>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>What are the different\u00a0storage classes\u00a0in C?<\/strong><\/p>\n<p>C has three types of storage: automatic, static and allocated.\u00a0 Variable having block scope and without static specifier have automatic storage duration.<\/p>\n<p><strong>What are the differences between malloc() and calloc()?<\/strong><\/p>\n<p>There are 2 differences.<\/p>\n<p>First, is in the number of arguments. malloc() takes a single argument(memory required in bytes), while calloc() needs 2 arguments(number of variables to allocate memory, size in\u00a0bytes of a single variable).<\/p>\n<p>Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.<\/p>\n<p><strong>What is the difference between const char* p and char const* p?<\/strong><\/p>\n<p>In const char* p, the character pointed by \u2018p\u2019 is constant, so u cant change the value of character pointed by p but u can make \u2018p\u2019 refer to some other location.<\/p>\n<p>In char const* p, the ptr \u2018p\u2019 is constant not the character referenced by it, so u cant make \u2018p\u2019 to reference to any other location but u can change the value of the char pointed by\u00a0\u2018p\u2019.<\/p>\n<p><strong>How can you determine the size of an allocated portion of memory?<\/strong><\/p>\n<p>You can\u2019t, really. free() can , but there\u2019s no way for your program to know the trick free() uses. Even if you disassemble the library and discover the trick, there\u2019s no guarantee the\u00a0trick won\u2019t change with the next release of the compiler.<\/p>\n<p><strong>Can static variables be declared in a header file?<\/strong><\/p>\n<p>You can\u2019t declare a static variable without defining it as well (this is because the storage class modifiers static and extern are mutually exclusive). A static variable can be defined in\u00a0a header file, but this would cause each source file that included the header file to have its own private copy of the variable, which is probably not what was intended.<\/p>\n<p><strong>Can a variable be both const and volatile?<\/strong><\/p>\n<p>Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code.<\/p>\n<p><strong>What is the output of\u00a0printf(&#8220;%d&#8221;)\u00a0?<\/strong><\/p>\n<p>When we write printf(&#8220;%d&#8221;, x); this means compiler will print the value of x. But as here, there is nothing after %d so compiler will show in output window garbage value.<\/p>\n<p><strong>What is a\u00a0null pointer?<\/strong><\/p>\n<p>There are times when it\u2019s necessary to have a pointer that doesn\u2019t point to anything. The macro NULL, defined in , has a value that\u2019s guaranteed to be different from any valid pointer<\/p>\n<p><strong>How to reduce a final size of\u00a0executable?<\/strong><\/p>\n<p>Size of the final executable can be reduced using dynamic linking for libraries.<\/p>\n<p><strong>How are pointer variables initialized?<\/strong><\/p>\n<p>Pointer variable are initialized by one of the following two ways<\/p>\n<ol>\n<li>Static memory allocation<\/li>\n<li>Dynamic memory allocation<\/li>\n<\/ol>\n<table style=\"background: #d9dde2;\">\n<tbody>\n<tr>\n<td style=\"border: 1px solid black;\">\n<h5 style=\"padding: 10px 10px 10px 10px;\"><strong> Are you Looking for C Programming Training? Please Enroll for Demo <a href=\" https:\/\/www.gologica.com\/course\/c-programming\/\"> C Programming..! <\/a><\/strong><\/h5>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>What is a method?<\/strong><\/p>\n<p>Method is a way of doing something, especially a systematic way; implies an orderly logical arrangement (usually in steps).<\/p>\n<p><strong>What is indirection?<\/strong><\/p>\n<p>If you declare a variable, its name is a direct reference to its value. If you have a pointer to a variable, or any other object in memory, you have an indirect reference to its value.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is C language? The C programming language is a standardized programming language developed in the early 1970s by Ken &hellip;<\/p>\n","protected":false},"author":1,"featured_media":2103,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"pmpro_default_level":"","footnotes":""},"categories":[15223],"tags":[],"coauthors":[182],"class_list":["post-1061","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it-service-and-architecture","pmpro-has-access","user-has-not-earned"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C Programming Basic Concepts - GoLogica<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C Programming Basic Concepts - GoLogica\" \/>\n<meta property=\"og:description\" content=\"What is C language? The C programming language is a standardized programming language developed in the early 1970s by Ken &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\" \/>\n<meta property=\"og:site_name\" content=\"GoLogica\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-23T01:33:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-06T03:12:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"175\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\"},\"headline\":\"C Programming Basic Concepts\",\"datePublished\":\"2018-08-23T01:33:37+00:00\",\"dateModified\":\"2025-04-06T03:12:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\"},\"wordCount\":686,\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png\",\"articleSection\":[\"IT Service and Architecture\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\",\"url\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\",\"name\":\"C Programming Basic Concepts - GoLogica\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png\",\"datePublished\":\"2018-08-23T01:33:37+00:00\",\"dateModified\":\"2025-04-06T03:12:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png\",\"width\":300,\"height\":175,\"caption\":\"C Programming\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.gologica.com\/elearning\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C Programming Basic Concepts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\",\"url\":\"https:\/\/www.gologica.com\/elearning\/\",\"name\":\"GoLogica\",\"description\":\"E-Learning Portal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.gologica.com\/elearning\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C Programming Basic Concepts - GoLogica","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:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/","og_locale":"en_US","og_type":"article","og_title":"C Programming Basic Concepts - GoLogica","og_description":"What is C language? The C programming language is a standardized programming language developed in the early 1970s by Ken &hellip;","og_url":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/","og_site_name":"GoLogica","article_published_time":"2018-08-23T01:33:37+00:00","article_modified_time":"2025-04-06T03:12:27+00:00","og_image":[{"width":300,"height":175,"url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#article","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/"},"author":{"name":"admin","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62"},"headline":"C Programming Basic Concepts","datePublished":"2018-08-23T01:33:37+00:00","dateModified":"2025-04-06T03:12:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/"},"wordCount":686,"image":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png","articleSection":["IT Service and Architecture"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/","url":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/","name":"C Programming Basic Concepts - GoLogica","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage"},"image":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png","datePublished":"2018-08-23T01:33:37+00:00","dateModified":"2025-04-06T03:12:27+00:00","author":{"@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62"},"breadcrumb":{"@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#primaryimage","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/C-Programming.png","width":300,"height":175,"caption":"C Programming"},{"@type":"BreadcrumbList","@id":"https:\/\/www.gologica.com\/elearning\/c-programming-basic-concepts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gologica.com\/elearning\/"},{"@type":"ListItem","position":2,"name":"C Programming Basic Concepts"}]},{"@type":"WebSite","@id":"https:\/\/www.gologica.com\/elearning\/#website","url":"https:\/\/www.gologica.com\/elearning\/","name":"GoLogica","description":"E-Learning Portal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","caption":"admin"},"url":"https:\/\/www.gologica.com\/elearning\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/comments?post=1061"}],"version-history":[{"count":3,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1061\/revisions"}],"predecessor-version":[{"id":2104,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1061\/revisions\/2104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media\/2103"}],"wp:attachment":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media?parent=1061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/categories?post=1061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/tags?post=1061"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/coauthors?post=1061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}