{"id":46,"date":"2015-07-12T17:46:07","date_gmt":"2015-07-12T16:46:07","guid":{"rendered":"http:\/\/watchdiana.fail\/blog\/?p=46"},"modified":"2015-07-12T17:46:07","modified_gmt":"2015-07-12T16:46:07","slug":"learn-c-the-hard-way-big-numbers","status":"publish","type":"post","link":"https:\/\/watchdiana.fail\/blog\/2015\/07\/12\/learn-c-the-hard-way-big-numbers\/","title":{"rendered":"Learn C the Hard Way &#8211; big numbers"},"content":{"rendered":"<p>Yep.<\/p>\n<p>If you take a number that has an optional sign, you need to leave room for the negative numbers.  If you don&#8217;t, all that room can be added up top instead, effectively doubling the size of the number-holder you can play with, as long as it&#8217;s positive.  If all you&#8217;re concerned with is the size of the number, that&#8217;s cool.  You&#8217;ve got a box that&#8217;s twice as long, but each unit in the box is double the size of the one before, so an unsigned long is really MASSIVE.<\/p>\n<p>It came out as 0 on my output.  I don&#8217;t know why.  Um, maybe the computer itself couldn&#8217;t handle it?  Compiler was happy, valgrind was happy, but it was outputting as 0.  I&#8217;ll have a think.<\/p>\n<p>Extra credit asks about why chars and ints can be treated just about the same.  Well, it&#8217;s just ones and zeros, innit?  So if the char and the int can be interchanged, then they get to be.  If not, if one won&#8217;t fit into the other, just throw a wobbly in the compiler.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yep. If you take a number that has an optional sign, you need to leave room for the negative numbers. If you don&#8217;t, all that room can be added up top instead, effectively doubling the size of the number-holder you can play with, as long as it&#8217;s positive. If all you&#8217;re concerned with is the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[7,9,11,13],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-coding","tag-c","tag-coding","tag-learn-c-the-hard-way","tag-things-i-do-because-im-stubborn","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":0,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/watchdiana.fail\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}