This blog is under construction

Friday 12 July 2013

C program to check whether the given ASCII is special character

Write a C program to check whether the given ASCII is special character.


  #include <stdio.h>
  int main() {
        int ch;

        /* get the ASCII value of the character */
        printf("ASCII value of special Character:");
        scanf("%d", &ch);

        /* determine the name of special character */
        switch (ch)  {
                case 0:
                        printf("Null character!!\n");
                        break;

                case 7:
                        printf("BELL Character!!\n");
                        break;

                case 8:
                        printf("Back Space Character!!\n");
                        break;

                case 9:
                        printf("Horizontal Tab!!\n");
                        break;

                case 10:
                        printf("Line Feed!!\n");
                        break;

                case 11:
                        printf("Escase Character!!\n");
                        break;

                case 127:
                        printf("Delete Character!!\n");
                        break;

                default:
                        printf("Unknown character!!\n");
                        break;
        }
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/$ ./a.out
  ASCII value of special Char:10
  Line Feed!!



No comments:

Post a Comment