C program to change string to upper case without strupr. I have used Code:: Blocks compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <stdio.h> void functionupper(char []); int main() { char string[100]; printf("Enter a string to convert it into upper case\n"); gets(string); functionupper(string); // calling functionupper printf("Entered string in upper case is \"%s\"\n", string); return 0; } void functionupper(char s[]) { int c = 0; while (s[c] != '\0') { if (s[c] >= 'a' && s[c] <= 'z') { s[c] = s[c] - 32; } c++; } } |
28 February 2019 1530 Written By: Rohit Mhatre
© 2020 Tech Study. All rights reserved | Developed by Tech Study| Privacy Policy | Sitemap