Friday, January 17, 2020

C String Uppercase: strupr()

The strupr(string) function returns string characters in uppercase. Let's see a simple example of strupr() function.

#include<stdio.h>
#include <string.h>
int main(){
char str[20];
printf("Enter string: ");
gets(str);//reads string from console
printf("String is: %s",str);
printf("\nUpper String is: %s",strupr(str));
return 0;
}

 
Output:
Enter string: anmolknowledge
String is: anmolknowledge
Upper String is: ANMOLKNOWLEDGE

No comments:

Post a Comment