It feels that you're soon going to be the only person known to cover A-Z, of C programming on TH-cam... All the other channels miss one topic or the other!! KEEP MAKING SUCH MORE VIDEOS!! 🔥🔥
Thank you for the enthusiastic feedback Darsh, I really appreciate it! :-) There are many, many more C videos I wish to make. Though in the long term, there are many other topics I wish to cover too.
This video is just perfect. no westing time, talks about the every possible scenario and gives solution for each of them while showcasing it perfectly. Best video ever.
Thank you for sharing this positive feedback Raed. And I'm so glad to hear the videos are helping you with your uni C course... helping students is the biggest reason why I love making these videos! :-)
I am studying computer science in Italy as an Italian and it makes me very sad when I come across situations like this. We are taught about the "input buffer", but our teachers simply tell us to use "fflush" without providing any explanation on how we can create our own version of this function. This lack of guidance and support is disheartening
Sorry to hear that. :-( Often times in programming we're left learning things ourselves at the end of the day, so it's good you're seeking out other sources to learn from.
As an Indian I never thought I'd have to watch any other nationals channel for learning programing, but since Ive discovered ur channel I mostly watch ur videos on topics I find hard to understand
Hello, sptr = &S[i]; 23 24 printf("Enter name: "); 25 scanf("%[^ ]s",sptr->name); I am having issue here when I use selective scanf then none of this input buffer works..what approach should I use? My program is regarding students information using structure array and accessing through structure pointer
Thanks so much for sharing this! I sort of prefer this method that you've shared, personally, because it's simpler. But just so people reading are aware, technically it's not 100% portable across C compilers. i.e. it's possible this statement will not work across all C compilers. See here: stackoverflow.com/a/16673023. That said, this method, as well as using fflush(stdin) are very widely supported in practice. :-)
Thank you. This worked for me in Visual Studio. "fflush(stdin);" seems to do nothing. "while ((c = getchar()) != ' ') {}" creates and infinite loop requesting input.
another great video that I added to my portfolio of solutions. if there Bigger than Thank you. Tell me what is it, and I will be glade to to send it back to you . Thanks a lot for helping us
Your program is an example for several things. #1 The C stdlib is not designed well ... this is a well known, and often discussed fact. #2 mixing fgets() with scanf() is usually a bad idea. better practise is to use fgets() to read a line from stdin, then parse this line using sscanf() #3 Do not forget to check returncodes from functions.
It feels that you're soon going to be the only person known to cover A-Z, of C programming on TH-cam... All the other channels miss one topic or the other!! KEEP MAKING SUCH MORE VIDEOS!! 🔥🔥
Thank you for the enthusiastic feedback Darsh, I really appreciate it! :-) There are many, many more C videos I wish to make. Though in the long term, there are many other topics I wish to cover too.
This video is just perfect. no westing time, talks about the every possible scenario and gives solution for each of them while showcasing it perfectly. Best video ever.
Your videos are getting me through my uni C course. You're a legend! Keep up the videos!
Thank you for sharing this positive feedback Raed. And I'm so glad to hear the videos are helping you with your uni C course... helping students is the biggest reason why I love making these videos! :-)
Just had to solve this one the other day. You are a treasure trove of useful c tips and tricks.
Thank you for the kind feedback Arthur! :-)
thank you so much. I am always confused whenever I see fflush and now I understand even more.
You're a legend. My go to for C programming on youtube.
Thank you for the kind feedback Jacob, I'm really glad these videos are your go to for C programming on TH-cam! :-D
Thanks for this! The lingering '
' after a scanf is one of the most annoying features of C!
printf("Excellent explanation , to the point. Thank you.");
I am studying computer science in Italy as an Italian and it makes me very sad when I come across situations like this. We are taught about the "input buffer", but our teachers simply tell us to use "fflush" without providing any explanation on how we can create our own version of this function. This lack of guidance and support is disheartening
Sorry to hear that. :-( Often times in programming we're left learning things ourselves at the end of the day, so it's good you're seeking out other sources to learn from.
yea, you are right :)
Very informative and to the point.
I’m glad that you enjoyed it Firas! :-)
Thanks for referring me to this video. Much appreciated
You're welcome Ahmad! :-)
As an Indian I never thought I'd have to watch any other nationals channel for learning programing, but since Ive discovered ur channel I mostly watch ur videos on topics I find hard to understand
you helped me so much and kept my brain braining, thank you
You're welcome! :-)
Thanks! Subscribed + liked.
Hello, sptr = &S[i];
23
24 printf("Enter name: ");
25 scanf("%[^
]s",sptr->name);
I am having issue here when I use selective scanf then none of this input buffer works..what approach should I use? My program is regarding students information using structure array and accessing through structure pointer
The fflush() does not work in my compiler. Please remember that fgets() also include the
in the string
Thank you, That was my question 😊
Hahaha yes, your question inspired this video. :-)
You can also use fseek() to clear input buffer.
fseek(stdin, 0, SEEK_END);
Thanks so much for sharing this! I sort of prefer this method that you've shared, personally, because it's simpler. But just so people reading are aware, technically it's not 100% portable across C compilers. i.e. it's possible this statement will not work across all C compilers. See here: stackoverflow.com/a/16673023. That said, this method, as well as using fflush(stdin) are very widely supported in practice. :-)
Thank you. This worked for me in Visual Studio.
"fflush(stdin);" seems to do nothing.
"while ((c = getchar()) != '
') {}" creates and infinite loop requesting input.
Tanks for another advance topic 😉
You're welcome Hasdrubal! :-)
Thank you. I always use while( getchar() != '
' ); to clear input buffer, but never include c != EOF. It is good to know.
You're welcome Eden, I'm glad you learned something new! :-)
your videos are super clear easy and amazing, please make a video about cybersecurity 💚💙💙💙
Thank you for the positive feedback! Hopefully one day I can cover cybersecurity, though it's a very big topic. :-)
Really nice, now i had tottaly understanded how its working
Find your video while searching of alternative fflush(), Thanks!
You're welcome, I'm glad the video was able to help you out! :-)
another great video that I added to my portfolio of solutions. if there Bigger than Thank you. Tell me what is it, and I will be glade to to send it back to you . Thanks a lot for helping us
Thank you for the support as always Naboulsi! :-)
Your program is an example for several things.
#1 The C stdlib is not designed well ... this is a well known, and often discussed fact.
#2 mixing fgets() with scanf() is usually a bad idea.
better practise is to use fgets() to read a line from stdin, then
parse this line using sscanf()
#3 Do not forget to check returncodes from functions.
Thank you a lot sir
You’re welcome! :-)
very interesting tnx
I've just been thinking about this xd
Haha that's a funny coincidence! :-) I had a few people running into this problem in the comments of other videos so I decided to make this video.
Thanks man!
You’re welcome! :-)
Of course you can build a function that you can use repeatedly to flush the stdin.
Legend
thank you so much
You're welcome Safeya! :-)
thanks❤
Good
Thank you! :-)
why not just:
while(getchar() != '
');
He wanted to make it simpler
Nice
Thank you! :-)