I would advise against a laptop if ergonomics are a factor, they are slightly better than smartphones but still overall bad. Get some basic PC setup (if you don't want to build your own, I suggest an ASUS mini PC or mac mini) and spend the rest on getting a decent chair, a desk where the monitor and keyboard/mouse are at levels that are comfortable for you.
I dont really see the point of the 2nd line in main, fgets already makes sure to null terminate