lim is the size of the s[] array. It's how many char can fit into s, minus the string terminator, which takes up one element. The function is similar to the library function fgets().