본문 바로가기
C언어/입력

[C언어] 문자열 입력받는 방법

by bigpicture 2022. 6. 27.
반응형

충분히 긴 길이의 문자형 배열을 정의하고, scanf 로 입력받으면 됩니다. 

#include <stdio.h>

int main()
{
    printf("문자를 입력하세요 \n");

    char mystr[50];
    scanf("%s",mystr);
    
    printf("입력한 문자는 %s 입니다",mystr);
    
    return 0;
}
반응형

댓글