{"id":5469,"date":"2022-08-01T00:01:37","date_gmt":"2022-08-01T07:01:37","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=5469"},"modified":"2022-08-08T08:18:56","modified_gmt":"2022-08-08T15:18:56","slug":"from-a-and-a-to-z-and-z","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=5469","title":{"rendered":"From &#8216;A&#8217; and &#8216;a&#8217; to &#8216;Z&#8217; and &#8216;z&#8217;"},"content":{"rendered":"<h2>Difficulty: &#9733; &#9734; &#9734; &#9734;<\/h2>\n<p>Here&#8217;s an easy exercise to try, something for those first learning C programming but also a challenge for experienced users: Output the alphabet A to Z in both upper and lowercase letters. It&#8217;s an &#8220;easy&#8221; exercise only when you don&#8217;t explore the possibilities.<br \/>\n<!--more--><br \/>\nThe output string looks like this:<\/p>\n<p><code>AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz<\/code><\/p>\n<p>An obvious and easy solution is the following statement:<\/p>\n<p><code>printf (\"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz\\n\";<\/code><\/p>\n<p>Because I&#8217;m showing this solution in the post, you can&#8217;t use it. No, you must probably employ some type of loop. Remember, if you&#8217;re a beginner, this exercise can be a challenge. For experienced C programmers, I believe the true challenge is being creative with your solution.<\/p>\n<p>Here&#8217;s a hint: On the ASCII table, the difference between lowercase and uppercase character codes is 32.<\/p>\n<p>I&#8217;ve created <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=5476\">five solutions<\/a> to this Exercise. Each one uses a different approach, from the simple and obvious to the convoluted and insane. Please try the challenge on your own before you peek to see what I&#8217;ve done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This exercise may be too easy for some, but only when you don&#8217;t explore the many possible solutions. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=5469\">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-5469","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\/5469","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=5469"}],"version-history":[{"count":4,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5469\/revisions"}],"predecessor-version":[{"id":5488,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5469\/revisions\/5488"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}