<div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">안녕하세요 공부를 하던중 의문이 생겨서 질문 남기게 되었습니다.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">//a.c</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">static int a;</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">void setA()</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">{</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"> a = 10;</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">}</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">void useA()</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">{</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"> int b = a;</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">}</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">// b.c</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">#include "a.c"</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">setA();</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">useA();</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">// c.c</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">#include "a.c"</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">setA();</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">useA();</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">위와같이 세개의 파일이 있는 경우에 위와 같은 구조의 코드가 동작이 가능한것인가요 ?</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">만약 된다면 static 변수 a는 b.c나 c.c에서 같은 메모리 공간에 있는 a를 a.c를 통해 접근하게 되는것인가요?</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">고수분들께서 설명을 조금만 해주시면 감사하겠습니다.</div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;"><br></div> <div style="font-family:'3028545_9';list-style:none;margin:0px;padding:0px;color:#636363;line-height:16px;">추가로 하나만 더 여쭙자면 저렇게 .c파일을 include하는것도 상관이없는건가요 ?</div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.