1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

feat(solutions): add camel-case/c/function

This commit is contained in:
Divlo
2021-09-29 22:20:41 +02:00
parent a1a0c65c16
commit 0c078abb89
10 changed files with 206 additions and 4 deletions

View File

@ -10,10 +10,11 @@ void character_append(char* string, char character) {
}
const char character_to_upper(const char character) {
int a_ascii_code = (int)'a';
int z_ascii_code = (int)'z';
if (character >= a_ascii_code && character <= z_ascii_code) {
return character - 32;
char ascii_a = 'a';
char ascii_A = 'A';
char ascii_z = 'z';
if (character >= ascii_a && character <= ascii_z) {
return character + (ascii_A - ascii_a);
}
return character;
}

View File

@ -2,6 +2,8 @@
#include <stdio.h>
#include "character.h"
char* input() {
char character;
size_t length = 1;