McqMate
I'm a beginner working on a project for my C programming course. I tried using scanf("%s", name); to read the name, but it stops at whitespace. I then switched to fgets(name, 100, stdin); which reads the entire line, but it leaves a newline character in the string. I've attempted to trim it with a loop, but it's messy. Could you advise on a clean solution for basic C programs?
Maria Garcia
1 week ago