First, and foremost! Indent your code properly. Without proper indentation not only you won't see what your program is doing, but also no one here will bother to read the code.
Second of all, when you compile your code, enable all warnings
and even turn them into errors, like so:
gcc -o example -Wall -Werror -Wextra example.c
If you do that for this code, you'll notice three things:
- “lim” is used before it's initialised,
- you should specify return type of “main()” to be “int”,
- and printf's “%s” expects “char *” but it's given and “int”.
I hope those hints will help you solve your problem. Since you are learning it's better if you figure this one out for yourself.
And remember, compiler is your friend – listen to what its saying.