English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C 언어의 isalnum() 함수

이 기능isalnum()문자가 알파벳 숫자인지 확인하는 데 사용됩니다. 문자가 알파벳 숫자이면 비절대값 값을 반환하고, 아닐 경우 0을 반환합니다. "ctype.h" 헤더 파일에서 선언됩니다.

이것은isalnum()C 언어의 문법

int isalnum(int character);

여기서

문자-검사할 문자입니다.

이것은isalnum()C 언어의 예제

예제

#include<stdio.h>
#include<ctype.h>
int main() {
   char val1 = 's';
   char val2 = '8';
   char val3 = '$';
   if(isalnum(val1))
   printf("The character is alphanumeric\n");
   else
   printf("The character is not alphanumeric\n");
   if(isalnum(val2))
   printf("The character is alphanumeric\n");
   else
   printf("The character is not alphanumeric");
   if(isalnum(val3))
   printf("The character is alphanumeric\n");
   else
   printf("The character is not alphanumeric");
   return 0;
}

출력 결과

The character is alphanumeric
The character is alphanumeric
The character is not alphanumeric

위 프로그램에서 char 타입의 세 개의 변수를 선언하고 초기화했습니다. 다음과 같이 사용합니다:isalnum()함수는 이 변수들이 알파벳 숫자 값인지 확인합니다.

if(isalnum(val1))
printf("The character is alphanumeric\n");
else
printf("The character is not alphanumeric\n");