toUpper - Tests character and converts to uppercase if lowercase in C

#include<stdio.h>
#include<ctype.h>

int main()
{
    int counter=0;
    char mychar;
    char str[]="TeSt THis a sample seNTeNce.\n";
    
    while (str[counter])
    {
        mychar=str[counter];
        putchar (toupper(mychar));
        counter  ;
    }
    return 0;
}