No worries ! It ' s something you build an intuition for overtime . Nothing is implicitly wrong with having a longlinear main function . What ' s wrong with the pictured code is that appears to be similar blocks of logic copied over and over again . For imperative languages like C , instead of rewriting the same block of code you could move that logic into a function and replace each instance in main with a single function call . Modularity is gained from breaking your code into functions . However , modularity doesn ' t guarantee reusability . It just enables the code to be reused . It does , however , make the code more readable which is the main drawback to having everything in main . So you may want to put code into its own function even if you ' re only going to call it once as it makes the code easier to read . Ideally the main should be the most abstract function consisting mostly of function calls and the logic interacting with the IO of those functions . Hypothetically , if a program has good function namescomments , the main would be a relatively abstract roadmaprecipeschematic that describes the logic the program follows to do what it claims to do .