{"id":88,"date":"2006-12-19T09:54:06","date_gmt":"2006-12-19T09:54:06","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=88"},"modified":"2006-12-19T09:54:06","modified_gmt":"2006-12-19T09:54:06","slug":"strings-in-c-can-span-multiple-lines","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=88","title":{"rendered":"Strings in C can span multiple lines"},"content":{"rendered":"<p>I came across a multi-line string while doing an inspection on a colleagues C code. I&#8217;ve never seen this sort of thing before, and didn&#8217;t know it was possible. <\/p>\n<p>Something like this:<\/p>\n<pre><code>\r\n    char* welcomeMessage = \"Hello \"\r\n                           \"Dale. \"\r\n                           \"How are you?\";\r\n\r\n    printf(\"%s\", welcomeMessage);\r\n<\/code><\/pre>\n<p>will happily print out &#8220;Hello Dale. How are you?&#8221;. <\/p>\n<p>It seems that you can define a string literal in C across multiple lines, without any need for a concatenation character (like &#8216;+&#8217; in Java and C#). <\/p>\n<p>I like that, even though I&#8217;ve been writing C for years now, I still occasionally come across little bits and pieces in the language that are new to me. And doing code inspections and reviews of other people&#8217;s code are a good way to share this sort of stuff and learn from each other.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I came across a multi-line string while doing an inspection on a colleagues C code. I&#8217;ve never seen this sort of thing before, and didn&#8217;t know it was possible. Something like this: char* welcomeMessage = &#8220;Hello &#8221; &#8220;Dale. &#8221; &#8220;How are you?&#8221;; printf(&#8220;%s&#8221;, welcomeMessage); will happily print out &#8220;Hello Dale. How are you?&#8221;. It seems [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}