본문 바로가기
C언어/문자열

[C언어] 문자출력 vs 문자열출력

by bigpicture 2022. 3. 8.
반응형

문자는 %c 서식문자를 이용하여 출력하고, 문자열은 %s 서식문자를 이용하여 출력한다. 

 

#include <stdio.h>

int main()
{
    
    char word='h';
    char* string="hi hello";

    printf("문자 : %c \n",word);
    printf("문자열 : %s",string);


}

 

아래는 결과입니다. 

 

반응형

댓글