Handling String Input With Spaces | C Programming Tutorial

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

fgets() also retains the final newline character, which is undesirable. Your scanf pattern seems to be better. Thank you for this great video. I learned a lot.

shvideo
Автор

Thank you. I appreciate you for replying to all comments.

X-VIPRIN
Автор

The only problem with fgets() is that fgets() also stores the \n character. To remove you can use
s[strcspan(s, "\n")] = '\0'
to replace the last \n with the NULL terminator

MarcoAurelio-svtk
Автор

Thank you, this helped me alot in my assignment.

sekutofu
Автор

Thanks a lot you helped with this concept a lot i was struggling so much with %c and %s

Nallu_Swami
Автор

Learnt soo much from this video! Thank You!!

a.v
Автор

That was a great tutorial. Thank you!

rodrigodiazdevivar
Автор

All these 3 examples are not working in my program, 😢 what can I do?

dineshshaw
Автор

I've watched quite a few of the videos on strings in C. But C strings are one-byte long. How does one hand Unicode strings, UTF-encoded strings, etc. Can you prepare a video on such strings?

Mnogojazyk
Автор

Thank u man I was so confused before this

wildhorn
Автор

your content is good, but videos in the playlist name (c programming tutorials) are randomly arranged, please arrange it topic by topic if possible

Aabara_ka_dabara
Автор

But from the beginning of our program we allocated 100 places for our String input.
So, as I understand it, there is a possibility that the length will be exceeded and we will get bad behavior.
Or another situation when we allocated 100 places, but only 10 were used. Does it mean that other space that we have booked will be wasted somehow?

I hope my thought is clear, I am not a native speaker =)

NikitaSafronov-yi
Автор

Does the %*c part flush the \n character that stays in the stdin file? If that's so, it's very neat, because I didn't know and I was using if(getchar()); to flush standard input.

gammyhorse
Автор

i struggle with reading a string that starts with a white space. if i use scanf it does not read it, and if i use gets or fgets it reds the new line character that is before that

douaahadad
Автор

thank you. exactly what was needed to shine light on this AND without an annoying accent.

davidlandivar
Автор

How do you take a character and a string until EOF though?

charchar
Автор

If I want to use getchar() to save list of string, I mean if I want to save 10 different string on array, How can I do that? Thank you

alvinfadhilahyusuf
Автор

Why doesn't the string requires to ampersand (&) in scanf?

JL_Minty
Автор

I have doubt on, something you write before entering input ... Like bash 3.2$
Why you write this?

amalayakin
Автор

Yaa, that worked on different programs, but the program in which I want to take full name including spaces, in that it's not working.
To be more clear, I have a structure program in c, using for loop i am taking names of students and taking marks from user, in that thing, non of above explained things worked.

If you able to understand my problem, I would love to see some solutions from you.

mithil