{"id":4720,"date":"2021-05-01T00:01:56","date_gmt":"2021-05-01T07:01:56","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=4720"},"modified":"2021-05-08T08:30:39","modified_gmt":"2021-05-08T15:30:39","slug":"unravel-the-mystery-code","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=4720","title":{"rendered":"Unravel the Mystery Code"},"content":{"rendered":"<h2>Difficulty: Easy<\/h2>\n<p>The C compiler preprocessor is a sneaky and powerful thing. I&#8217;m unsure of any other programming languages that have such a tool.<br \/>\n<!--more--><br \/>\nFor example, you can redefine pretty much the entire language, not only keywords but operators and elements of syntax. To wit, this code compiles and runs:<\/p>\n<pre class=\"screen\">\r\nbegin program\r\nstart\r\nprint(\"Hello!\")\r\nend\r\nstop<\/pre>\n<p>This code outputs the text <code>Hello!<\/code>. It compiles using any C compiler. It works. Of course, this example isn&#8217;t the entire code. That&#8217;s because a series of <code>#define<\/code> preprocessor directives creates the faux code. When the preprocessor is done, the compiler recognizes everything and creates a program.<\/p>\n<p>Your task for this month&#8217;s Exercise is to write the complete C program. It contains the lines listed above, which are the final lines of code. But your solution also features a series of preprocessor directives that make everything work. You must properly code those directives.<\/p>\n<p><a href=\"https:\/\/c-for-dummies.com\/blog\/?p=4739\">Click here<\/a> to view my solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can this code possibly compile in C? <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=4720\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4720","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4720"}],"version-history":[{"count":5,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4720\/revisions"}],"predecessor-version":[{"id":4762,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4720\/revisions\/4762"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}