Only if you googled it…
char buf[11];
fgets(buf, sizeof(buf), stdin);
11 char = 10 char plus the terminating NUL.
More Related Contents:
- Dynamic Array of strings [closed]
- Seg fault on code that should work according to the professor [duplicate]
- Can I change the datatype of previously declared variable in C?
- MIPS program that implements the same algorithm in C
- C: Reading strings from binary file
- What is the difference between char s[] and char *s?
- How can I correctly assign a new string value?
- How to use sscanf in loops?
- enum to string in modern C++11 / C++14 / C++17 and future C++20
- How does strtok() split the string into tokens in C?
- What is the fastest substring search algorithm?
- Returning string from C function
- Reversing a string in C
- “error: assignment to expression with array type error” when I assign a struct field (C)
- How do I lowercase a string in C?
- String Padding in C
- How to split a string to 2 strings in C
- Print all the permutations of a string in C
- Why does char* cause undefined behaviour while char[] doesn’t?
- Concatenating strings in C, which method is more efficient?
- Strange character after an array of characters
- Varying string variable in an if condition
- How to remove the character at a given index from a string in C?
- String.indexOf function in C
- Does C support raw string literals?
- Does C have any tools for doing string addition?
- Creating C formatted strings (not printing them)
- C split a char array into different variables
- A possible algorithm for determining whether two strings are anagrams of one another? [closed]
- Counting words in a string – c programming