{"id":848,"date":"2014-03-07T14:22:59","date_gmt":"2014-03-07T12:22:59","guid":{"rendered":"\/\/www.mcgill.org.za\/stuff\/?p=848"},"modified":"2014-03-07T14:24:22","modified_gmt":"2014-03-07T12:24:22","slug":"arrays","status":"publish","type":"post","link":"https:\/\/www.mcgill.org.za\/stuff\/archives\/848","title":{"rendered":"Arrays"},"content":{"rendered":"<p>A programmer working on a large project noticed that every single variable was stored in a separately named instance:<\/p>\n<pre>\r\nint c1, c2, c3, c4, c5, c6;\r\n<\/pre>\n<p>This meant that there was a lot of code of this sort:<\/p>\n<pre>\r\nc1++;\r\nc2++;\r\nc3++;\r\nc4++;\r\nc5++;\r\nc6++;\r\n<\/pre>\n<p>Of course, this can be done more efficiently with a loop, so the programmer suggested it.  None of his co-workers understood the concept, so he approached the boss, and showed him some example code, that would do the same thing in a loop:<\/p>\n<pre>\r\nint c[6], i;\r\nfor (i=0; i&lt;sizeof(c);i++) {\r\n  c[i]++;\r\n}\r\n<\/pre>\n<p>He explained to his boss that this small change was a necessary improvement to the system architecture and skills of the programming team.  His boss having once been a programmer understood completely, and asked, &#8220;So you want arrays?&#8221;  <\/p>\n<p>&#8220;Yes,&#8221; he replied.  <\/p>\n<p>On payday there was a substantial increase in his renumeration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A programmer working on a large project noticed that every single variable was stored in a separately named instance: int c1, c2, c3, c4, c5, c6; This meant that there was a lot of code of this sort: c1++; c2++; &hellip; <a href=\"https:\/\/www.mcgill.org.za\/stuff\/archives\/848\">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":[2],"tags":[138,136,137,190,11],"class_list":["post-848","post","type-post","status-publish","format-standard","hentry","category-stuff","tag-arrays","tag-joke","tag-programming","tag-stuff","tag-stupidity"],"_links":{"self":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/comments?post=848"}],"version-history":[{"count":3,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/848\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/posts\/848\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/media?parent=848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/categories?post=848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mcgill.org.za\/stuff\/wp-json\/wp\/v2\/tags?post=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}