How to use scanf with fgets

preview_player
Показать описание
Source code can be found here:

===== Support us through our store =====

===== Check out our website =====

===== Check out our Discord server =====
Рекомендации по теме
Комментарии
Автор

I was so confused whule working on a practice problem, and you sir, helped me, not only figure out the solution, but also understand why it is the solution. Thank you bro!

ziadhamdi
Автор

Nobody talked about that problem, only you did that and helped me. Thanks a lot man!

b.t
Автор

Wow! That's why follow your channel, here I get not only solutions but also the underhood mechanism behind the behavior. Keep up the good work. Thanks for providing such wonderful lectures.

MKSundaram
Автор

Your C language tutorial is a very high-quality course. Very effective! Thank's.

PETERTRITSCH
Автор

Thank you so much for your C tutorials. Pls keep 'em coming!!

tdsdv
Автор

You are explaining C language the best on YT. Thx!

stonedcodingtom
Автор

Thanks for the great video. It seems all the input functions ie. getchar(), scanf() getc() etc... use the same input buffer and is why the problem occurs ie. when characters remain in the buffer they are recognized as user input by the next call to scanf() and is the reason they are skipped. In the video was used fgetc() to clear the newline; however, trying getchar() it seems to do the same job.

towtruckn
Автор

It's really sad that C is such an old language and yet still they didn't solved this problem. Thanks for another well explained video.

gammyhorse
Автор

You are a life saver. Can't thank you enough !!!!

mehedihasanmridul
Автор

Is possible to use "%d%*c" on scanf format specifier. That will read the number (%d part) and the "\n", then will ignore the "\n" (the * character ignores the matching case and the "c" means a character), this way you dont have to make another function call (fgetc(stdin)) and also use one less line.

jelsonrodrigues
Автор

Thank you so much, I was so confused on why my fgets function was not executing, but worked completely fine when I moved it at the very start of my main function. Now I know😂

jonathanlin-rvzl
Автор

This was a great explanation, as all your videos are. Thank you!

ISKLEMMI
Автор

You helped me, so let me help you with that YouTube algorithm.

xsangrezulx
Автор

Thanks a lot, that was a clear and concise explanation :)

moosaawad
Автор

You are amazing. I have to learn C for an intro to computer systems class and your tutorials have been invaluable for my learning. Thank you!

firepower
Автор

thank you very much, I looked for over 20 minutes for a solution to my problem and there was not a single video or webpage that explained the \n issue, thanks for the 10/10 tutorial

fulcrodestructor
Автор

Man, you are awsome. Thank you for what you do

thiagoflores
Автор

Thank you so much! I was so frustrated on why my code is not working and searched on the web but found nothing. And then I found this video and the way you explained it was so amazing and easy to understand and my code is working! Thank you!

mohammedfaizy
Автор

thank you very much your videos are like a savior to me
keep going, man!

aseeldee.
Автор

Mashallah. Your videos are awesome. Keep up the good work brother.

abirahammedbhuiyan