If you want to optimize your delChar-function, you could create a new string and only copy the valid characters to it, instead of shifting the entire original string on every occurrence of character to remove.
Code:
void delChar(const char *, char *, char);
int main ()
{
char str[100], str2[100]; /* No need to malloc the memory in this case */
printf("Enter a string\n");
fgets(str,100,stdin);
printf("You entered %s\n", str);
delChar(str, str2, 'o');
printf("New String: %s\nOld string: %s\n", str2, str);
return 0;
}
void delChar(const char *src, char *dst, char c)
{
while (*(src) != '\0') {
if (*(src) != c)
*(dst++) = *(src);
src++;
}
*(dst) = '\0';
}