Programming techniques Flashcards
what is a subprogram and what is its purpose?
small programs written inside of a larger, main program
-to perform a specific task
what are the 2 types of subprograms?
functions and procedures
why is a subprogram being small in size a benefit? (2)
-meaning they are much easier to write, test and debug.
-easy for someone else to understand.
why can saving a subprogram as a separate module be beneficial? (2)
-used again in other programs.
-saves time because the programmer can use code that has already been written, tested and debugged.
how can subprograms make programs more efficient? (2)
-may be used repeatedly at various points in the main program.
-the code only has to be written once, resulting in shorter programs
similarities and differences between procedures and functions?
similarities: performs a specific task
difference: functions return values/ data back to the main program, procedures do not