This blog is under construction

Sunday, 18 March 2012

iswalnum

Header file:
    wctype.h

Synopsis:
    int iswalnum(wint_c wc)

Description:
    Returns non-zero if the given input is an alphanumeric character.  Otherwise it returns 0.


Sample Program for iswalnum in c:



  #include <stdio.h>
  #include <wchar.h>
  #include <wctype.h>
  int main() {
        wint_t wide_char;
        char input;
        printf("Enter your input:");
        input = getchar();

        /* mbtowc -Converts single byte to wide character format */
        wide_char = btowc(input);

        if (iswalnum(wide_char))
                printf("It is an alphanumeric\n");
        else
                printf("It is not an alphanumeric\n");

        printf("Return value: %d\n", iswalnum(wide_char));
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms/chap4$ ./a.out
  Enter your input:B
  It is an alphanumeric
  Return value: 8

No comments:

Post a Comment