Header file:
wctype.h
Synopsis:
wint_t towupper (wint_t input)
wint_t towupper (wint_t input)
Description:
If input is in lower case letter, it returns the corresponding upper case letter. Otherwise input is returned unchanged.
Sample program for towupper 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 character to wide character format */
wide_char = btowc(input);
printf("Return value: %c\n", towupper(wide_char));
return 0;
}
#include <wchar.h>
#include <wctype.h>
int main() {
wint_t wide_char;
char input;
printf("Enter your input:");
input = getchar();
/* mbtowc -Converts character to wide character format */
wide_char = btowc(input);
printf("Return value: %c\n", towupper(wide_char));
return 0;
}
Output:
Enter your input:a
Return value: A
Return value: A
No comments:
Post a Comment