Question
1 - WAP to implement your own isxdigit() function Description: c-type library functions check whether ch, which must have the value of an unsigned char
1 - WAP to implement your own isxdigit() function
Description:
c-type library functions check whether ch, which must have the value of an unsigned char or EOF, falls into a certain character class according to the current locale.
isxdigit() - checks for a hexadecimal digit i.e. given character is between '0' - '9' or 'a' - 'f' or 'A' - 'F'
Pr-requisites: -
Functions
Objective: -
To understand the concept of
Functions
Inputs: - An ASCII character Outputs: - 0 or non-zero value based on condition success or failure Sample execution: - Test Case 1: Enter the character: a Entered character is an hexadecimal digit Test Case2: Enter the character:3 Entered character is an hexadecimal digit Test Case 3: Enter the character:G
Entered character is not an hexadecimal digit
requested file:
#include
int is_xdigit(int);
int main() { char ch; short ret; printf("Enter a character: "); scanf("%c", &ch); ret = is_xdigit(ch); /* Based on the return value of the function print the message */ return 0; }
//
2.
2 - WAP to implement your own islower() function
Description:
c-type library functions check whether ch, which must have the value of an unsigned char or EOF, falls into a certain character class according to the current locale.
islower() - checks for a lower case alphabet whether entered character is between 'a' to 'z'.
Pr-requisites: -
Functions
Objective: -
To understand the concept of
Functions
Inputs: -
An ASCII character
Outputs: -
0 or non-zero value based on condition success or failure
Sample execution: - Test Case 1: Enter the character: a Entered character is lower case alphabet Test Case 2: Enter the character:3 Entered character is not lower case alphabet
requested file:
#include
int my_islower(int);
int main() { char ch; int ret; printf("Enter the character:"); scanf("%c", &ch); ret = my_islower(ch); /* Based on return value, print whether ch is lower case alphabet or not */ }
//
3 - WAP to implement your own ispunct() function
Description:
c-type library functions check whether ch, which must have the value of an unsigned char or EOF, falls into a certain character class according to the current locale.
ispunct() - checks for any printable character which is not a space or an alphanumeric character.
Pr-requisites: -
Functions
Objective: -
To understand the concept of
Functions
Inputs: -
An ASCII character
Outputs: -
0 or non-zero value based on condition success or failure
Sample execution: - Test Case 1: Enter the character: a Entered character is not punctuation character Test Case 2: Enter the character:$ Entered character is punctuation character
requested file:
#include
int my_ispunct(int);
int main() { char ch; int ret; printf("Enter the character:"); scanf("%c", &ch); ret = my_ispunct(ch); /* Based on return value, print whether ch is lower case alphabet or not */ }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started