I've started reading many c books in the past few weeks, and have been enjoying learning them. I followed this one example from a c book, whick demonstrates the system function which is as follows:
Now, it compiles and works fine, but while compiling it say's:
/*This demonstrates the system function*/
/*declare a buffer to hold input*/
puts("\nEnter a system command, blank to exit");
/*Exit if input == null*/
if(input == '\0')
so i got curious, and didn't set and array size for input, and left it as -
/tmp/ccWRQUCs.o(.text+0x28): the 'gets' function is dangerous and should not be used.
and the message about the gets function was not printed onscreen while compiling.
Why does it stop printing the gets warning when not setting a size for input? Why is the gets command so dangerous?
Thankyou very much for your time.