remove char from string

#include <stdio.h>
#include <string.h>

void removeChar(char *str, char charToRemove) {
    int len = strlen(str);
    int i, j;

    for (i = 0, j = 0; i < len; i++) {
        if (str[i] != charToRemove) {
            str[j++] = str[i];
        }
    }
    str[j] = '\0';
}

int main() {
    char inputString[100];
    char charToRemove;

    printf("Enter a string: ");
    fgets(inputString, sizeof(inputString), stdin);

    printf("Enter the character to remove: ");
    scanf("%c", &charToRemove);

    removeChar(inputString, charToRemove);

    printf("String after removing '%c': %s", charToRemove, inputString);

    return 0;
}