COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string2.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <string.h>
3
// Task2. Build the toLower() function here.
4
5
void
toLower
(
char
a[]){
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
}
15
int
main
(){
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
}
main
int main()
Definition
string2.c:15
toLower
void toLower(char a[])
Definition
string2.c:5
Module10
string2.c
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0