So I wrote the following method:
void removeEndingColon(char *charArrayWithColon) {
// remove ':' from variableName
size_t indexOfNullTerminator = strlen(charArrayWithColon);
charArrayWithColon[indexOfNullTerminator - 1] = '\0'; // replace ':' with '\0'
}
But when I test it with the following code in eclipse, I get no output and I don't know why my executable isn't able to run.
char *charArray1 = "ThisHasAColonAtTheEnd:";
removeEndingColon(charArray1);