This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:iot-open:introductiontoembeddedprogramming2:cppfundamentals:functions [2023/11/21 22:23] – pczekalski | en:iot-open:introductiontoembeddedprogramming2:cppfundamentals:functions [2023/11/23 10:20] (current) – pczekalski | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Sub-programs, | ====== Sub-programs, | ||
+ | {{: | ||
In many cases, the program grows to a size that becomes hardly manageable as a single unit. It isn't easy to navigate through the code that occupies many screens. In such a situation, subprograms can help. Subprograms are named functions in C and C++; while they are associated with an object, they are called methods (in this chapter, the name // function // will be used). The function contains a set of statements that usually form some logical part of the code that can be separately tested and verified, making the whole program easy to manage. Grouping many functions by creating a library stored in a separate file is possible. This is how external libraries are constructed. | In many cases, the program grows to a size that becomes hardly manageable as a single unit. It isn't easy to navigate through the code that occupies many screens. In such a situation, subprograms can help. Subprograms are named functions in C and C++; while they are associated with an object, they are called methods (in this chapter, the name // function // will be used). The function contains a set of statements that usually form some logical part of the code that can be separately tested and verified, making the whole program easy to manage. Grouping many functions by creating a library stored in a separate file is possible. This is how external libraries are constructed. | ||