<pre style="font-family:'Roboto Mono', 'Source Code Pro', Monaco, monospace;font-size:14.4px;margin-top:0px;overflow:auto;color:#455a64;background-color:#eceff1;"><code class="hljs cpp" style="font-family:'Roboto Mono', 'Source Code Pro', Monaco, monospace;padding:0px;color:inherit;background-color:transparent;display:inline;margin-top:0px;"> <span class="hljs-keyword" style="color:#7b59c0;">char</span>* Req_topic[] = {<span class="hljs-number" style="color:#a65926;">0</span>,}; <span class="hljs-keyword" style="color:#7b59c0;">char</span> Req_topic_SerialNumber[] = {<span class="hljs-number" style="color:#a65926;">0</span>,}; <span class="hljs-built_in" style="color:#a65926;">strcat</span>(Req_topic_SerialNumber , <span class="hljs-string" style="color:#918b3b;">"qqq/aaa/bbb/"</span>); <span class="hljs-built_in" style="color:#a65926;">strcat</span>(Req_topic_SerialNumber, SERIALNUM); <span class="hljs-built_in" style="color:#a65926;">strcat</span>(Req_topic_SerialNumber , <span class="hljs-string" style="color:#918b3b;">"/cccc"</span>); <span class="hljs-built_in" style="color:#a65926;">printf</span>(<span class="hljs-string" style="color:#918b3b;">"111\n"</span>); Req_topic[<span class="hljs-number" style="color:#a65926;">0</span>] = Req_topic_SerialNumber; <span class="hljs-built_in" style="color:#a65926;">printf</span>(<span class="hljs-string" style="color:#918b3b;">"222\n"</span>); <span class="hljs-built_in" style="color:#a65926;">printf</span>(<span class="hljs-string" style="color:#918b3b;">"Req_topic : %s\n"</span>, Req_topic); <span class="hljs-built_in" style="color:#a65926;">printf</span>(<span class="hljs-string" style="color:#918b3b;">"333\n"</span>); </code></pre> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">위와 같이 컴파일(g++) 하고 난뒤에 프로그램 실행시</p> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">111</p> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">222</p> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">Req_topic : ` vvbbb/SERIALNUM/cccc</p> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">333</p> <p class="pre" style="margin:0px;font-family:Roboto, '맑은 고딕', 'malgun gothic', '돋움', Dotum, sans-serif;font-size:16px;background-color:#fbfbfc;">./mm: line 3: 3783 세그멘테이션 오류 이렇게 실행이 되는데 왜앞의 문자열은 깨지고 오류가 나는지 이해가 안가서 질문올립니다....</p>