c 초보입니다.

oilsok의 이미지

#include <stdio.h>
#include <string.h>
void main()
{
        char str[10];
        strcpy(str,"string");
        printf("%s\n",str);
        str[1]='A';
        printf("%s\n',str);
}

이렇게 하고 저장하고 컴파일 하려니까,,글쎄..
knut% ls
test     test.c   test2.c
knut% gcc -o test2 test2.c
test2.c:9: unterminated string or character constant
test2.c:9: possible real start of unterminated constant
knut%

이렇게 나오네요 ㅡㅡ 왜그러져?
oilsok의 이미지

printf("%s\n',str);

수정 하고 다시 컴파일 하니까 이번엔..

knut% gcc -o test2 test2.c
test2.c: In function `main':
test2.c:4: warning: return type of `main' is not `int'

도대체 어쩌라는 건지 ㅡㅡ

skydancer의 이미지

그냥 경고 입니다.
컴파일 정상적으로 된겁니다....
경고를 없애시려면
void main() -> int main()
하시고
main 마지막 줄에
return 0;
해주시면 됩니다.

웃어요^,.^;

익명 사용자의 이미지

printf("%s\n',str);

인가요

printf("%s\n",str);

nobby의 이미지

printf("%s\n",str);