[go: up one dir, main page]

0% found this document useful (0 votes)
45 views1 page

Capitalize.c Function List: My - Capitalize / / Function Name: My - Capitalize Arguments: Char STR - Pointer To String That Needs To Be Capitalized

This C code file defines a function called my_capitalize that capitalizes a string. The function takes a character pointer as an argument and loops through the string, converting characters between 'a' and 'z' to their uppercase equivalents by subtracting 32 (the difference between ASCII values of 'a' and 'A') from each character value.

Uploaded by

Abhay Tomar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views1 page

Capitalize.c Function List: My - Capitalize / / Function Name: My - Capitalize Arguments: Char STR - Pointer To String That Needs To Be Capitalized

This C code file defines a function called my_capitalize that capitalizes a string. The function takes a character pointer as an argument and loops through the string, converting characters between 'a' and 'z' to their uppercase equivalents by subtracting 32 (the difference between ASCII values of 'a' and 'A') from each character value.

Uploaded by

Abhay Tomar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

capitalize.

1 /*
2 * capitalize.c
3 *
4 * Function list: my_capitalize
5 *
6 */
7
8 /*
9 * Function name: my_capitalize
10 * arguments: char* str - pointer to string that needs to be capitalized
11 *
12 */
13
14 void my_capitalize(char *str)
15 {
16 for (int i=0; str[i]!='\0'; i++) {
17 if (str[i] < 'a')
18 continue;
19 str[i]=str[i]-32;
20 }
21 }
22

Page 1

You might also like