Remove First Occurrence Of A Character From A String | C Programming Example

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

always clearn and explanation on points, It's hard to master string manipulation in C but with your video I manage to understand most of it.

alessiotucci
Автор

Great explanation, I actually understand it a little bit better.

AtomicBl
Автор

Please sir can you solve many hard exercises about the 2D array and the string .and thank you for your efforts .

GreatGirl-qecm
Автор

The strlen will also do a loop to count until char \0. So why not do ''while string[I]!='\0' "? It will be much faster on big string. Edit : or do a while 1 and then a test and break if char is null at the start of the block.
Edit2 : i see that you already did a course how to avoid using strlen.

jp
Автор

Bravo ! thanks
Dumb question
You declared the function "remove_first()" and defined it later below. Is that Ok to do ? Should we define it first and declare it later ?

Little-bird-told-me
Автор

Excellent video!

What I don't understand is how the parameter that is passed as a value and not as a reference is modified inside and outside the function.

When calling from main() to:

remove_first( char string[], const char to_remove) the variable string is passed as a value and not as a reference, therefore a copy of it is created within remove_first().

From what I understand, it should be:

void remove_first( char *string[], const char to_remove) {
}

And it would be called like this:

remove_first( &string, to_remove);

Is not correct ?

Thanks!

angelffg
join shbcf.ru