NULL null nil 0

down7town의 이미지

현재 C 언어에서 널 포인터를 나타내는 키워드는 nil 이 아니라 0이라고 하더군요.. 파스칼을 경우 nil을 사용하고 다시 0은 define에 의해 대부분 NULL로 사용된다고 하는데, gcc 3.2.2를 사용하는데, nil을 에러 메시지에 포함시켜서 출력하네요... 혼란스럽군요..

char *qutation_ptr
28 qutation_ptr=strchr(urldata->compl_url,' \' ');
29 if (qutation_ptr!=NULL);
30 {
31 printf("qutation_ptris %p",qutation_ptr);
32 printf("쿼테이션 발견 %s",urldata->compl_url);
33 printf("qutation_ptrs string is%s",qutation_ptr);
34 }
35
출력결과
qutation_ptris (nil)쿼테이션 발견 /alertVulnerable/scriptqutation_ptrs string is(null)

결과로 봐서는 널포인터일경우 nil로 출력되고 뒤에 나온 null은 널스트링의 의미로 그렇게 한것 같은데,,

현재 C에서 nil과 null의 관계가 궁금합니다.

위의 코드는 if뒤에 코딩오류를 포함하고 있습니다. ; <-----

moonzoo의 이미지

길지 않다면 전체 소스를 올리시는 보세요..

전 C에서 nil은 첨 들어보네여..