#include <stdio.h>

int main() {
    //자료형 배열이름[배열크기]
    char str1[] = "coding";
    // 문자열의 마지막에는 널null문자 \0가 들어있다
    // 널null문자 : 문자열의 끝을 알려주는 문자
    printf("%s\n", str1);
    printf("%ld\n", sizeof(str1));

    for (int i = 0; i < sizeof(str1); i++) {
        printf("%d ", str1[i]); //아스키 코드
    }
    printf("\n");

    char kor[] = "박주현";
    printf("%s\n", kor);
    printf("%ld\n", sizeof(kor));
    //한글은 한 글자 당 3바이트 + \0



    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: