https://stackoverflow.com/q/66397924/15260761
If you use gets(), you get an error. You can use fgets() instead. char str[50]; fgets(str,50,stdin);