convert string to lowercase in c code example

Example: convert string to lowercase in c

// include all the libraries  used in the program.
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

// Base Function
int main(int argc, string argv[])
{
    if (argc != 2)
    {
        printf("Usage: ./substitution key\n");
    }
    else if (strlen(argv[1]) != 26)
    {
        printf("Key must contain 26 characters.\n");
    }
    
    string key = argv[1].toupper();
    string key = argv[1].tolower();
}

Tags:

Cpp Example