Try using the
scanf("%hu", &length); ^
ISO/IEC 9899:201x – 188.8.131.52-7
Specifies that a following d , i , o , u , x , X , or n conversion
specifier applies to an argument with type pointer to short or
- Why does scanf() need “%lf” for doubles, when printf() is okay with just “%f”?
- How do you allow spaces to be entered using scanf?
- Why does reading into a string buffer with scanf work both with and without the ampersand (&)?
- What can I use for input conversion instead of scanf?
- How to do scanf for single char in C [duplicate]
- scanf() leaves the newline character in the buffer
- Reading string from input with space character? [duplicate]
- How to prevent scanf causing a buffer overflow in C?
- Disadvantages of scanf
- How can I read an input string of unknown length?
- Going through a text file line by line in C
- Why do I have to specify data type each time in C to printf() and scanf()?
- What is the difference between sscanf or atoi to convert a string to an integer?
- How to read string from keyboard using C?
- Reading in double values with scanf in c
- Read no more than size of string with scanf()
- Why is scanf() causing infinite loop in this code?
- Does sscanf(“123456789123456789123456789”, “%d”, &n) have defined behavior?
- What are scanf(“%*s”) and scanf(“%*d”) format identifiers?
- C – scanf() vs gets() vs fgets()
- How do you format an unsigned long long int using printf?
- How to achieve function overloading in C?
- How should I print types like off_t and size_t?
- Are typedef and #define the same in c?
- Do threads have a distinct heap?
- Quickly find whether a value is present in a C array?
- Why cast an unused function parameter value to void?
- Initializing entire 2D array with one value
- ISO C90 forbids mixed declarations and code in C
- Does the C standard explicitly indicate truth value as 0 or 1?
- The difference between asm, asm volatile and clobbering memory
- Why (and when) do I need to use parentheses after sizeof?
- Should we use exit() in C?
- What is the equivalent to getch() & getche() in Linux?
- Variable declaration after goto Label
- How does fread really work?
- How to compile makefile using MinGW?
- Combine Gyroscope and Accelerometer Data
- Does C have references?
- How to add a builtin function in a GCC plugin?
- C: socket connection timeout
- Getting IPV4 address from a sockaddr structure
- Why can two different enum enumeration-constants have the same integer value?
- Does C have a string type? [closed]
- Alternatives to `while (1)` to simplify branching [duplicate]
- How to increase performance of memcpy
- What happens in OS when we dereference a NULL pointer in C?
- glibconfig.h no such file or directory
- stdout thread-safe in C on Linux?
- How do I get a thread ID from an arbitrary pthread_t?