Header file:
ctype.h
Synopsis:
int isascii (int input)
Description:
Checks whether the given input is a 7-bit unsigned char value that fits into the ASCII character set.
Return Value:
TRUE(non-zero value) on success
0 on failure.
Sample Program:
#include<stdio.h>
#include<ctype.h>
int main() {
char c;
printf("Enter your input:");
c = getchar();
if (isascii(c))
printf("Given input is a 7 bit unsigned char\n");
else
printf("not an unsigned char that fits the ascii char set\n");
printf("Return value for isascii: %d\n", isascii(c));
return 0;
}
#include<ctype.h>
int main() {
char c;
printf("Enter your input:");
c = getchar();
if (isascii(c))
printf("Given input is a 7 bit unsigned char\n");
else
printf("not an unsigned char that fits the ascii char set\n");
printf("Return value for isascii: %d\n", isascii(c));
return 0;
}
Output:
jp@jp-VirtualBox:~/cpgms$ ./a.out
Enter your input:Q
Given input is a 7 bit unsigned char
Return value for isascii: 1
Enter your input:Q
Given input is a 7 bit unsigned char
Return value for isascii: 1
No comments:
Post a Comment