CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): sonsy ()
날 짜 (Date): 2003년 1월  2일 목요일 오후 01시 41분 39초
제 목(Title): [질문] 포인터와 배열 차이 .....



char s[] = "This is a test sring. It contains two sentence.";
char *temp;

main()
{
     int count;
     temp = s;
     printf("\n Original string = %s \n", temp);

     for (count = 0 ; *(temp+count) !='\0' ; count++)
     {
          if( *(temp+count) == '.' )
          {
           *(temp+count+1) = '\0';
           break;
          }
     }
 printf("\n Modified string = %s\n ", temp);
}
======================================================================

여기서, char *temp = "This is a test sring. It contains two sentence.";
라고 초기화 하면서, 선언하면, core dump 된다고 나오네여.

temp 와 s 를 따로 선언해야 하나여????



[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.