When using fgets in a loop, it doesn't take a new string, it scans from where it left in the previous string. Any idea how to solve that? Great video btw
@@himanshurajpal7842 That is undefined behavior in both the C and POSIX standards, you can use this but your code will not be portable and behavior may change on a compiler update or with higher optimization levels on the same compiler.
Thanks bro, good explanation👍🏻👏🏻
Thank you, very helpful
thank you Minhaj!
thanks minhaj ur a certified beauty
Thanks for the video, it was great 👍
Thanks!
Nice video bro 👍🏻👍🏻
Thx
chandigarh university wale like here
When using fgets in a loop, it doesn't take a new string, it scans from where it left in the previous string. Any idea how to solve that?
Great video btw
Use fflush(stdin)
@@himanshurajpal7842 That is undefined behavior in both the C and POSIX standards, you can use this but your code will not be portable and behavior may change on a compiler update or with higher optimization levels on the same compiler.
My solution is to this code after calling fgets:
if (buffer[strlen(buffer)-1] != '
') {
int c;
while ((c = getchar()) != '
' && c != EOF);
}
gets ka kha tha isme ?
Is conio.h usefull?
What is the " _getch() " in the line above return 0 ? Quickly reply please.
wait a response from your keyboard
Holds the output screen for sometime and it also hides like hide the input character entered by users in a password or an ATM.
What is the role of stdin there?
Stdin means read from 'standard input'. String uses array where you want to read the strings from
#include is header file
you ended never use fgets, never use scanf functions. but if thats so whats your opinion? thanks sir anyways
Bruh....he said .....gets() & scanf() are worst working with string,........fgets() was recommended