printf("It is currently %s's turn.\n", current->name);
I'm wondering why this is printing out additional newline after the %s. I am aware that strings in C always ends with \\0. How do I print it without it?
Your variable current->name
has a newline in it, so you need to get rid of that newline.
current->name[strcspn(current->name, "\n")] = '\0';
This piece of code will help you get rid of the unwanted newline. Put it before printf
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.