{"id":47710,"date":"2022-04-01T18:57:16","date_gmt":"2022-04-01T18:57:16","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/function-return-values-in-c\/"},"modified":"2022-04-01T18:57:16","modified_gmt":"2022-04-01T18:57:16","slug":"function-return-values-in-c","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/function-return-values-in-c\/","title":{"rendered":"Function return values in c++"},"content":{"rendered":"<div>\n<p><em>The code here tests a user-entered character and returns values depending on whether the character is numeric, upper case, etc.\u00a0\u00a0<\/em><\/p>\n<p><em>Enter the code, note the output, and answer the questions below. \u00a0\u00a0Put your answers into a Word document.\u00a0 \u00a0<\/em><\/p>\n<p>#include &lt;stdio.h&gt;<\/p>\n<p>#include &lt;ctype.h&gt;<\/p>\n<p>int main(void)<\/p>\n<p>{printf(&#8220;Enter a character: &#8220;);<\/p>\n<p>int c = getchar();<\/p>\n<p>if (isdigit(c) == 0)<\/p>\n<p>{printf(&#8220;User has entered the character: %cn&#8221;, c);<\/p>\n<p>printf(&#8220;isalnum(&#8216;%c&#8217;) = %dn&#8221;, c, isalnum(c));<\/p>\n<p>printf(&#8220;isxdigit(&#8216;%c&#8217;) = %dn&#8221;, c, isxdigit(c));<\/p>\n<p>printf(&#8220;islower(&#8216;%c&#8217;) = %dn&#8221;, c, islower(c));<\/p>\n<p>printf(&#8220;isupper(&#8216;%c&#8217;) = %dn&#8221;, c, isupper(c));<\/p>\n<p>printf(&#8220;tolower(&#8216;%c&#8217;) = %dn&#8221;, c, tolower(c));<\/p>\n<p>printf(&#8220;toupper(&#8216;%c&#8217;) = %dn&#8221;, c, toupper(c));<\/p>\n<p>printf(&#8220;isspace(&#8216;%c&#8217;) = %dn&#8221;, c, isspace(c));<\/p>\n<p>printf(&#8220;iscntrl(&#8216;%c&#8217;) = %dn&#8221;, c, iscntrl(c));<\/p>\n<p>printf(&#8220;ispunct(&#8216;%c&#8217;) = %dn&#8221;, c, ispunct(c));<\/p>\n<p>printf(&#8220;isprint(&#8216;%c&#8217;) = %dn&#8221;, c, isprint(c));<\/p>\n<p>printf(&#8220;isgraph(&#8216;%c&#8217;) = %dn&#8221;, c, isgraph(c));<\/p>\n<p>}<\/p>\n<p>return 0;<\/p>\n<p>}<\/p>\n<p>\u00a0<\/p>\n<p><em>Complete the sentence\u00a0When the user enters the value of &#8220;a,&#8221;\u00a0 for each of the following:<\/em><\/p>\n<p><em>1. Why does isalum() return the value 2?<\/em><\/p>\n<p><em>2. Why does isxdigit() return the value 128?<\/em><\/p>\n<p><em>3. Why does islower() return the value 2?<\/em><\/p>\n<p><em>4. Why does isupper() return the value 0?<\/em><\/p>\n<p><em>5. Why does tolower() return the value 97?<\/em><\/p>\n<p><em>6. Why does toupper() return the value 65?<\/em><\/p>\n<p><em>7. Why does isspace() return the value 0?<\/em><\/p>\n<p><em>8.Why does iscntrl() return the value 0?<\/em><\/p>\n<p><em>9.Why does ispunct() return the value 0?<\/em><\/p>\n<p><em>10. Why does isprint() return the value 2?<\/em><\/p>\n<p><em>11. Why does isgraph() return the value 2?<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The code here tests a user-entered character and returns values depending on whether the character is numeric, upper case, etc.\u00a0\u00a0 Enter the code, note the output, and answer the questions below. \u00a0\u00a0Put your answers into a Word document.\u00a0 \u00a0 #include &lt;stdio.h&gt; #include &lt;ctype.h&gt; int main(void) {printf(&#8220;Enter a character: &#8220;); int c = getchar(); if (isdigit(c) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-47710","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=47710"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/47710\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=47710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=47710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=47710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}