COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string2.c File Reference
#include <stdio.h>
#include <string.h>
Include dependency graph for string2.c:

Go to the source code of this file.

Functions

int main ()
 
void toLower (char a[])
 

Function Documentation

◆ main()

int main ( void )

Definition at line 15 of file string2.c.

15 {
16 char input[100];
17 // Task 1. Read in user input to the char array input.
18 scanf("%s", input);
19 toLower(input);
20 // Task 3. Call the toLower function.
21 printf("%s", input);
22}
void toLower(char a[])
Definition string2.c:5

References toLower().

Here is the call graph for this function:

◆ toLower()

void toLower ( char a[])

Definition at line 5 of file string2.c.

5 {
6 // To be implemented by you.
7 // strlen is string.length() in C++
8 for (int i = 0; i < strlen(a); i++){
9 if (a[i] >= 'A' && a[i] <= 'Z'){
10 a[i] = a[i] + 32;
11 }
12 }
13
14}

Referenced by main().

Here is the caller graph for this function: