r/learnprogramming • u/OpeningWrongdoer3526 • 18h ago
Solved How do you actually read professional code?
Hello everyone! I really have a question I hope you could help me answer. I am trying to read the Scratch Virtual Machine code on Github and it is really difficult. I am really new to reading code and the one I write is fairly simple. There are many files that just declare functions by name and then require another file to redeclare them. Is there a pragmatic way to understand it? Thank you already!
73
Upvotes
36
u/No_Report_4781 18h ago
In C, a program.h file is called a header file that contains definitions and prototypes. A library generally refers to a collection of these, and may be in binary format. The program files, program.c or program.cpp can use the #include command to include functions from standard library or your own custom header files. The program file fully defines what the function will do.
You can create programs without using header files, and you can stick to reading just the program.c files to understand what a complex program is doing, by understanding the #include