About this document
Understanding C by hamsdao King is a document available to read on EtoBox.
The gets() and puts() functions in C are used for input and output of strings. Gets() reads a string from the user including spaces into a character array until enter is pressed, while puts() prints the given string to the console and returns the number of characters printed. Both functions are declared in stdio.h. Gets() is risky due to the lack of bounds checking on the input while fgets() allows specifying the maximum number of characters to avoid buffer overflows.
- Author
- hamsdao King
- Language
- EN