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:
@ -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;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "character.h"
|
||||
|
||||
char* input() {
|
||||
char character;
|
||||
size_t length = 1;
|
||||
|
Reference in New Issue
Block a user