{"id":42198,"date":"2021-09-07T15:51:54","date_gmt":"2021-09-07T15:51:54","guid":{"rendered":"https:\/\/www.oracletutoring.ca\/blog\/?p=42198"},"modified":"2021-09-07T15:51:56","modified_gmt":"2021-09-07T15:51:56","slug":"comp-sci-what-is-casting","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/comp-sci-what-is-casting\/","title":{"rendered":"Comp Sci: what is casting?"},"content":{"rendered":"\n<h2>Tutoring comp sci, casting will come up: the tutor defines it.<\/h2>\n<p>\n<em>Casting<\/em>, in computer science, means changing a variable&#8217;s type to a different one. Typically, the result will be stored in a new variable.<\/p>\n<p>An example where casting might be needed is as follows: Receiving user input, it&#8217;s usually thought of as a string. Yet, what if it&#8217;s meant to be a decimal number? (You can&#8217;t predictably add strings.)<\/p>\n<p>If x is the input, then typically you&#8217;ll see something like y=(float)x; then, y will contain the float (in simple terms, decimal) representation of the number that was entered. This operation is typically called <em>casting<\/em> or a <em>cast<\/em>.<\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/www.cprogramming.com\/tutorial\/c\/lesson11.html\">cprogramming.com<\/a><\/p>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.\n","protected":false},"excerpt":{"rendered":"<p>Tutoring comp sci, casting will come up: the tutor defines it. Casting, in computer science, means changing a variable&#8217;s type to a different one. Typically, the result will be stored in a new variable. An example where casting might be &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/comp-sci-what-is-casting\/\"> <span class=\"screen-reader-text\">Comp Sci: what is casting?<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-42198","post","type-post","status-publish","format-standard","hentry","category-computer-science"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/42198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=42198"}],"version-history":[{"count":5,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/42198\/revisions"}],"predecessor-version":[{"id":42203,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/42198\/revisions\/42203"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=42198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=42198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=42198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}