[ C ] Sample Code –

샘플 코드 – 문자열 비교의 예

#include <stdio.h>
#include <string.h>

int main() {
    char str(100);

    printf("문자열을 입력하세요: ");
    fgets(str, sizeof(str), stdin);

    if (strcmp(str, "Hello, World!
\n") == 0) { printf("입력한 문자열은 \"Hello, World!
\"와 같습니다.

\n"); } else { printf("입력한 문자열은 \"Hello, World!
\"와 다릅니다.

\n"); } return 0; }