{"id":369,"date":"2013-03-24T14:00:53","date_gmt":"2013-03-24T21:00:53","guid":{"rendered":"http:\/\/192.168.1.2\/wordpress\/?p=369"},"modified":"2013-05-13T14:48:10","modified_gmt":"2013-05-13T21:48:10","slug":"ctci-ch-1-2","status":"publish","type":"post","link":"http:\/\/cywang.no-ip.org\/wordpress\/?p=369","title":{"rendered":"CTCI: Ch. 1-2"},"content":{"rendered":"<p>\n\t<strong>Implement a function void reverse(char* str) in C or C++ which reverses a null-terminated string.<\/strong>\n<\/p>\n<p>\n\t<!--more-->\n<\/p>\n<pre class=\"brush:cpp;\">\r\n#include &lt;iostream&gt;\r\n#include &lt;string.h&gt;\r\nusing namespace std;\r\nvoid reverse(char* str);\r\n\r\nvoid reverse(char* str)\r\n{\r\n    char tmp;\r\n    for(int i=0;i&lt;strlen(str)\/2;i++)\r\n    {\r\n        tmp = str[strlen(str)-i-1];\r\n        str[strlen(str)-i-1] = str[i];\r\n        str[i] = tmp;\r\n    }\r\n    \r\n}\r\n\r\nint main(int argc, const char * argv[])\r\n{\r\n    char ch[]=&quot;12345678\\0&quot;;\r\n    reverse(ch);\r\n    cout&lt;&lt;ch&lt;&lt;endl;\r\n    return 0;\r\n}<\/pre>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Implement a function void reverse(char* str) in C or C++ which reverses a null-terminated string.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[19,6],"tags":[],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-chapter-1-arrays-and-strings","category-cracking-the-coding-interview"],"_links":{"self":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=369"}],"version-history":[{"count":5,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions"}],"predecessor-version":[{"id":428,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/369\/revisions\/428"}],"wp:attachment":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}