{"id":1274,"date":"2015-03-08T09:03:58","date_gmt":"2015-03-08T16:03:58","guid":{"rendered":"http:\/\/c-for-dummies.com\/blog\/?page_id=1274"},"modified":"2017-01-29T08:17:08","modified_gmt":"2017-01-29T16:17:08","slug":"posting-code-in-a-comment","status":"publish","type":"page","link":"https:\/\/c-for-dummies.com\/blog\/?page_id=1274","title":{"rendered":"Posting Code in a Comment"},"content":{"rendered":"<p>If you want to upload code in a comment, you&#8217;ll need to know a wee bit of HTML formatting. That&#8217;s because common characters like <code>&lt;<\/code>, <code>&gt;<\/code>, and <code>&amp;<\/code> are interpreted by the web page browser as HTML, not C code.<\/p>\n<p>&bull; Prefix your code by using the <code>&lt;pre&gt;<\/code> tag. That way all the spaces and indents are retained.<\/p>\n<p>&bull; Postfix your code by using the <code>&lt;\/pre&gt;<\/code> tag. That tag marks the end of the preformatted text block.<\/p>\n<p>&bull; If you code uses the <code>&lt;<\/code> or <code>&gt;<\/code> symbols, which it will if you&#8217;re including any header files, then you need to specify <code>&amp;lt;<\/code> for <code>&lt;<\/code> and <code>&amp;gt;<\/code> for <code>&gt;<\/code>. If not, the browser would fail to see the following text:<\/p>\n<pre>&lt;stdio.h&gt;<\/pre>\n<p>That text above would be interpreted as HTML, which it isn&#8217;t. So no text would appear in the comment.<\/p>\n<p>&bull; Remember that your typical <em>for<\/em> loop uses the <code>&lt;<\/code> or <code>&gt;<\/code> characters, so scan for those. Also scan for <em>if<\/em>, <em>while<\/em>, and <em>else<\/em> keywords.<\/p>\n<p>&bull; The code for the <code>&amp;<\/code> character is <code>&amp;amp;<\/code>. If you&#8217;re doing a logical AND operation, you need two of them: <code>&amp;amp;&amp;amp;<\/code> for <code>&amp;&amp;<\/code>.<\/p>\n<p>All these recommendations are optional, but consider using them if you want the code in your comment to be readable.<\/p>\n<p>If you would like to register, drop me an email and I&#8217;ll sign you up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to upload code in a comment, you&#8217;ll need to know a wee bit of HTML formatting. That&#8217;s because common characters like &lt;, &gt;, and &amp; are interpreted by the web page browser as HTML, not C code. &hellip; <a href=\"https:\/\/c-for-dummies.com\/blog\/?page_id=1274\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2278,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1274","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/1274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/page"}],"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=1274"}],"version-history":[{"count":3,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/1274\/revisions"}],"predecessor-version":[{"id":1277,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/1274\/revisions\/1277"}],"up":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/pages\/2278"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}