i wanted to know how to use fgets(); to asked the user for a string. instead of using scanf to scan for a string instead becasue scanf can cause buffer overflow.
can someone give me an example
for examaple
Code:#include <stdio.h> main() { char name[25]; printf("name is"); scanf("%s",&name); // this is not good because it can cause overflow if my string is larger thatn 25. so how do you use fgets }