The obvious answer is to learn from what the compiler is trying to tell you – you should never, ever, use gets(), as it is totally unsafe. Use fgets() instead, which allows you to prevent possible buffer overruns.
#define BUFFER_SIZE 100
char buff[BUFFER_SIZE];
gets( buff); // unsafe!
fgets( buff, sizeof(buff), stdin ); // safe
Related Contents:
- Where does gcc look for C and C++ header files?
- Why do I get a warning every time I use malloc?
- Why does GCC use multiplication by a strange number in implementing integer division?
- Why does the order of ‘-l’ option in gcc matter? [duplicate]
- Using GCC to produce readable assembly?
- Hide password input on terminal
- Is bool a native C type?
- gcc, strict-aliasing, and horror stories [closed]
- Undefined reference to `pow’ and `floor’
- Is there a way to use gcc to convert C to MIPS?
- Why does GCC allocate more space than necessary on the stack, beyond what’s needed for alignment?
- Stack allocation, padding, and alignment
- Why does integer division by -1 (negative one) result in FPE?
- What are the benefits of a relative path such as “../include/header.h” for a header?
- How to turn on (literally) ALL of GCC’s warnings?
- How can I suppress “unused parameter” warnings in C?
- Can’t compile a C program on a Mac after upgrading to Catalina 10.15
- What does it mean to align the stack?
- CreateProcess: No such file or directory
- How do I make a simple makefile for gcc on Linux?
- how to print __uint128_t number using gcc?
- Why does GCC pad functions with NOPs?
- What is “!!” in C? [duplicate]
- How to compile a static library in Linux?
- How can I tell gcc not to inline a function?
- difference between %ms and %s scanf
- Bitshift and integer promotion?
- “undefined reference to `pow'” even with math.h and the library link -lm [duplicate]
- Can I mix static and shared-object libraries when linking?
- Why does this memory address %fs:0x28 ( fs[0x28] ) have a random value?
- __attribute__((const)) vs __attribute__((pure)) in GNU C
- Reading a register value into a C variable [duplicate]
- What does “control reaches end of non-void function” mean?
- Empty structure in C
- Working of __asm__ __volatile__ (“” : : : “memory”)
- GCC left shift overflow
- How to compile my own glibc C standard library from source and use it?
- Why does the compiler allocate more than needed in the stack?
- Which compiler should I trust?
- How can I multiply 64 bit operands and get 128 bit result portably?
- What happens with an extern inline function?
- GCC – no warning about an uninitialized array with -O0
- Create statically-linked binary that uses getaddrinfo?
- Status of __STDC_IEC_559__ with modern C compilers
- What does -fwrapv do?
- Can I make gcc tell me when a calculation results in NaN or inf at runtime?
- Pointer arithmetic when void has unknown size [closed]
- Printf long long int in C with GCC?
- Query on -ffunction-section & -fdata-sections options of gcc
- conflicting types error when compiling c program using gcc