From 68e5650300b45e684e260a493423fd1b7a824c85 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Mon, 6 Feb 2023 16:43:50 +0100 Subject: [PATCH] Implementation of function calLen(). --- src/helperFunctions.c | 10 ++++++++++ src/helperFunctions.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/helperFunctions.c b/src/helperFunctions.c index 71c6a63..740c5a0 100644 --- a/src/helperFunctions.c +++ b/src/helperFunctions.c @@ -1,6 +1,10 @@ #include "helperFunctions.h" /*Code written by Julius Philipp Engel, fdai7057*/ +int main(){ + +} + char *stringConcatenation(char *string_1, char *string_2) { int lengthStringOne = strlen(string_1); @@ -138,6 +142,12 @@ double balanceToDouble(char *balanceAsString) return sign * result / power; } +unsigned int calLen(char *str){ + int len = 0; + while(*(str+len)!='\0') ++len; + return len; +} + bool characterIsUpperCase(char inputCharacter) { bool result = (inputCharacter>='A'&&inputCharacter<='Z') ? true : false; diff --git a/src/helperFunctions.h b/src/helperFunctions.h index 64083d5..40146d1 100644 --- a/src/helperFunctions.h +++ b/src/helperFunctions.h @@ -13,5 +13,6 @@ unsigned int power(unsigned int, unsigned int); bool everyCharacterIsDigit(char *); bool isLetterOfAlphabet(char *); double balanceToDouble(char *); +unsigned int calLen(); bool charIsUpperCase(char ); #endif