Function name : strupr
Header file : <string.h>
Function prototype: char *strupr(char *str);
Function : Convert all lowercase letters in the string to uppercase
Parameters : char *str is the string to be converted
Return value : Returns the converted uppercase string
Note : This function does not generate a new string, but modifies the original string. Therefore, str can only be a character array, not the string pointed to by the string pointer, because the string pointer points to a string constant, and the constant cannot be modified.
Program example: Convert all lowercase letters in the string array str to uppercase
#include<string.h>#include<stdio.h>intmain(void){charstr[20]=wWw.dotCpp.coM,*ptr;ptr=strupr(str);printf(%sn,ptr); return0;}
Running results:
WWW.DOTCPP.COM