Trying to create C function to convert a String ASCII to upper case.
This is what I tried and it does not work:
static void PrefixToUpper(volatile char* Prefix, int PrefixLen) {
// User code starts below this comment
for (int i = 0; Prefix[i] != '\0' ; i++)
{
if(Prefix[i] >= 'a' && Prefix[i] <= 'z')
{
Prefix[i] = Prefix[i] - 32;
}
}
// User code ends above this comment } // User code starts below this comment
Tested the code in C compiler and it runs correctly:
static void PrefixToUpper(volatile char* Prefix)
{
// User code starts below this comment
for (int i = 0; Prefix != '\0' ; i++)
{
if(Prefix >= 'a' && Prefix <= 'z')
{
Prefix = Prefix - 32;
}
}
// User code ends above this comment
}
int main()
{
char str[] = "hmh00234";
printf("String input: %s\n", str);
PrefixToUpper(str);
printf("String output: %s\n", str);
}